Skip to content

Commit

Permalink
Fixed url encoded path to correct slashes and entry path point
Browse files Browse the repository at this point in the history
  • Loading branch information
retroluxfilm authored and retroluxfilm committed Mar 1, 2022
1 parent f0dc585 commit d896bfe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Repository/RepositoryHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ public static function generateGuidV4(): string
*/
public static function urlEncodePath(string $path) : string{

return implode(DIRECTORY_SEPARATOR, array_map("rawurlencode", explode(DIRECTORY_SEPARATOR, $path)));
// first url raw encode elements between directory seperator
$urlEncoded = implode(DIRECTORY_SEPARATOR, array_map("rawurlencode", explode(DIRECTORY_SEPARATOR, $path)));
// remove first relative path point and seperator
$urlEncoded = str_replace("." + DIRECTORY_SEPARATOR,"",$urlEncoded);
// convert directory seperator to forward slashes
$urlEncoded = str_replace(DIRECTORY_SEPARATOR,"/",$urlEncoded);
return $urlEncoded;
}
}

0 comments on commit d896bfe

Please sign in to comment.