From bd2f14d510308a3131cd64fa27d24db1e055fe7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Sandstr=C3=B6m?= Date: Sat, 1 Dec 2018 22:08:04 +0100 Subject: [PATCH] Make media URLs in accordance with the Link Policy (#3536) Credit to @adsa95 --- modules/system/classes/MediaLibrary.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/system/classes/MediaLibrary.php b/modules/system/classes/MediaLibrary.php index 941f6c757..b49a17d0b 100644 --- a/modules/system/classes/MediaLibrary.php +++ b/modules/system/classes/MediaLibrary.php @@ -6,6 +6,7 @@ use Cache; use Config; use Storage; use Request; +use Url; use October\Rain\Filesystem\Definitions as FileDefinitions; use ApplicationException; use SystemException; @@ -538,7 +539,9 @@ class MediaLibrary { $path = $this->validatePath($path); - return $this->storagePath.$path; + $fullPath = $this->storagePath.implode("/", array_map("rawurlencode", explode("/", $path))); + + return Url::to($fullPath); } /**