Skip to content

Commit

Permalink
URL encoded url folder path to allow spaces in the folder names
Browse files Browse the repository at this point in the history
  • Loading branch information
retroluxfilm authored and retroluxfilm committed Feb 24, 2022
1 parent 859e555 commit f0dc585
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Repository/RepositoryHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public static function generateGuidV4(): string
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
}

/**
* Encodes an file path so that the url can be used in a link. It preserves the directory separators (slashes)
* @param string $path
* @return string
*/
public static function urlEncodePath(string $path) : string{

return implode(DIRECTORY_SEPARATOR, array_map("rawurlencode", explode(DIRECTORY_SEPARATOR, $path)));
Expand Down

0 comments on commit f0dc585

Please sign in to comment.