From f0dc585538b850b8fc2a03468fc0b91055b3c765 Mon Sep 17 00:00:00 2001 From: retroluxfilm Date: Thu, 24 Feb 2022 23:31:07 +0100 Subject: [PATCH] URL encoded url folder path to allow spaces in the folder names --- src/Repository/RepositoryHelper.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Repository/RepositoryHelper.php b/src/Repository/RepositoryHelper.php index 1369f54..29b2bb1 100644 --- a/src/Repository/RepositoryHelper.php +++ b/src/Repository/RepositoryHelper.php @@ -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)));