From f6b16e1d5a3b4faa1a2166e664c402eaa34cef1e Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Tue, 30 Dec 2014 18:11:45 +0100 Subject: Encode URL offered in filestorage. Fixes #780 --- mod/filestorage.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/filestorage.php b/mod/filestorage.php index a76a218af..6b731e440 100644 --- a/mod/filestorage.php +++ b/mod/filestorage.php @@ -127,10 +127,14 @@ function filestorage_content(&$a) { $lockstate = (($f['allow_cid'] || $f['allow_gid'] || $f['deny_cid'] || $f['deny_gid']) ? 'lock' : 'unlock'); + // Encode path that is used for link so it's a valid URL + // Keep slashes as slashes, otherwise mod_rewrite doesn't work correctly + $encoded_path = str_replace('%2F', '/', rawurlencode($cloudpath)); + $o = replace_macros(get_markup_template('attach_edit.tpl'), array( '$header' => t('Edit file permissions'), '$file' => $f, - '$cloudpath' => z_root() . '/' . $cloudpath, + '$cloudpath' => z_root() . '/' . $encoded_path, '$parentpath' => $parentpath, '$uid' => $channel['channel_id'], '$channelnick' => $channel['channel_address'], -- cgit v1.2.3