From ccb2c372bb1fb3980c1240ffb2f7aeef5e786dae Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Thu, 2 Apr 2020 10:18:23 -0600 Subject: [PATCH] Only force absolute URLs for media items if cms.linkPolicy = force This fixes #4082 & rainlab/pages-plugin#405. Reverts a previous breaking change from Build 444 (introduced in #3536) by limiting the scope to which it applies. --- modules/system/classes/MediaLibrary.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/system/classes/MediaLibrary.php b/modules/system/classes/MediaLibrary.php index 93b6fe58f..7c3c1abfe 100644 --- a/modules/system/classes/MediaLibrary.php +++ b/modules/system/classes/MediaLibrary.php @@ -537,9 +537,13 @@ class MediaLibrary { $path = $this->validatePath($path); - $fullPath = $this->storagePath.implode("/", array_map("rawurlencode", explode("/", $path))); + $fullPath = $this->storagePath . implode("/", array_map("rawurlencode", explode("/", $path))); - return Url::to($fullPath); + if (Config::get('cms.linkPolicy') === 'force') { + return Url::to($fullPath); + } else { + return $fullPath; + } } /**