]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix bug oc-542, encode urls for private links
authorMichael Gapczynski <GapczynskiM@gmail.com>
Mon, 7 May 2012 15:30:36 +0000 (11:30 -0400)
committerMichael Gapczynski <GapczynskiM@gmail.com>
Mon, 7 May 2012 15:30:36 +0000 (11:30 -0400)
apps/files_sharing/ajax/getitem.php
apps/files_sharing/js/share.js

index 6eed0408238c2b95b9cda84bed0d0000f291cf4a..36ac372cad44de36f695a702055b292889efe7ec 100755 (executable)
@@ -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
index f00db30e96d61e39cd325f3f48129ab09fa8d225..e23146798f29959a861887db3d78e919a5b67d6b 100644 (file)
@@ -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');