Skip to content

Commit

Permalink
Merge remote-tracking branch 'acoulton/patch-1' into fix/transfer-man…
Browse files Browse the repository at this point in the history
…ager-bare-buckets
  • Loading branch information
jeskew committed Jul 22, 2015
2 parents 3e11d5c + 39466ed commit 5f83656
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/S3/Transfer.php
Expand Up @@ -198,7 +198,7 @@ private function determineScheme($path)
}

/**
* Normalize a path so that it has a trailing slash.
* Normalize a path so that it has UNIX-style directory separators and no trailing /
*
* @param string $path
*
Expand Down Expand Up @@ -317,15 +317,16 @@ private function uploadMultipart($filename)

private function createS3Key($filename)
{
if (!isset($this->s3Args['Key'])) {
return '';
$relative_file_path = ltrim(
preg_replace('#^' . preg_quote($this->source['path']) . '#', '', $filename),
'/'
);

if (isset($this->s3Args['Key'])) {
return rtrim($this->s3Args['Key'], '/').'/'.$relative_file_path;
} else {
return $relative_file_path;
}

$args = $this->s3Args;
$args['Key'] = rtrim($args['Key'], '/');
$args['Key'] .= preg_replace('#^' . preg_quote($this->source['path']) . '#', '', $filename);

return $args['Key'];
}

private function addDebugToBefore($debug)
Expand Down

0 comments on commit 5f83656

Please sign in to comment.