From e0a5f976e75739d02ec0483ed54bbcf31ce0c470 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Mon, 7 May 2012 11:30:36 -0400 Subject: [PATCH] Fix bug oc-542, encode urls for private links --- apps/files_sharing/ajax/getitem.php | 2 +- apps/files_sharing/js/share.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php index 6eed0408238..36ac372cad4 100755 --- a/apps/files_sharing/ajax/getitem.php +++ b/apps/files_sharing/ajax/getitem.php @@ -19,7 +19,7 @@ while ($path != $userDirectory) { $item['privateLink'] = $token; } else { // If in parent folder, include a path parameter to get direct access to file - $item['privateLink'] = $token.'&path='.substr($source, strlen($path)); + $item['privateLink'] = $token.'&path='.str_replace('%2F', '/', str_replace('+', '%20', urlencode(substr($source, strlen($path)))));; } } else { // Check if uid_shared_with is a group diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index f00db30e96d..e23146798f2 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -179,7 +179,7 @@ OC.Share={ $('#privateLinkCheckbox').attr('checked', true); var link = parent.location.protocol+'//'+location.host+OC.linkTo('', 'public.php')+'?service=files&token='+token; if (token.indexOf('&path=') == -1) { - link += '&file=' + item; + link += '&file=' + encodeURIComponent(item); } else { // Disable checkbox if inside a shared parent folder $('#privateLinkCheckbox').attr('disabled', 'true'); -- 2.39.5