Skip to content

Conflict with DIRECTORY_SEPARATOR in S3RenameUpload #16

Closed
@jmsalazar84

Description

@jmsalazar84

Well, i'm using windows and i have some problems when i tried to put an object in my s3 bucket.
For example, i have this file:
/96/40/75/9640759a4b7e2a9aca8ee8f377af0740.png

But in muy bucket, this file its wrong
/96/40/75\9640759a4b7e2a9aca8ee8f377af0740.png

if you add this fix , i think we solve the problem.

protected function getFinalTarget($uploadData)
{
// We cannot upload without a bucket
if (null === $this->options['bucket']) {
throw new MissingBucketException('No bucket was set when trying to upload a file to S3');
}

    $target = parent::getFinalTarget($uploadData);

    // begin fix
    if(DIRECTORY_SEPARATOR != '/'){
        $target = str_replace(DIRECTORY_SEPARATOR, '/', $target);
    }
    // end fix

    return sprintf('s3://%s/%s', $this->options['bucket'], trim($target, '/'));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions