Skip to content

Commit

Permalink
Issie #2 Encode path parts and filename in the file URL.
Browse files Browse the repository at this point in the history
The file URL is needed when copying files to reference
the source resource.
  • Loading branch information
judgej committed Apr 9, 2018
1 parent 9845ade commit 668dbf1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/AzureFileAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public function __construct(IFile $azureClient, $config = [], $prefix = null)
}

/**
* Issue #2 Encode the path parts but not the directory separators.
*
* @param string $pathName the normalised file pathname
* @return string URL for the file, needed for some API methods
*/
Expand All @@ -72,7 +74,13 @@ protected function getUrl($pathName)
'%s%s/%s',
(string)$this->client->getPsrPrimaryUri(),
$this->container,
rawurlencode($pathName)
implode(
'/',
array_map(
'rawurlencode',
explode('/', $pathName)
)
)
);
}

Expand Down

0 comments on commit 668dbf1

Please sign in to comment.