]> source.dussan.org Git - nextcloud-server.git/commitdiff
Replace plus sign with space in files app URL #4932
authorVincent Petry <pvince81@owncloud.com>
Fri, 20 Sep 2013 19:52:40 +0000 (21:52 +0200)
committerVincent Petry <pvince81@owncloud.com>
Fri, 20 Sep 2013 20:08:57 +0000 (22:08 +0200)
Some apps create URLs to the files app and encode the spaces of a
directory using plus signs.

This fix ensures that plus signs are properly converted back to spaces
when parsing the URL on the JS side.

apps/files/js/filelist.js

index 4fc1b95a0ab5612bc48560b2328589cc83ab3179..3c99e3876c745166c935a42b3b13e05d50183e4f 100644 (file)
@@ -895,6 +895,10 @@ $(document).ready(function(){
                $(window).trigger('beforeunload');
        });
 
+       function decodeQuery(query){
+               return query.replace(/\+/g, ' ');
+       }
+
        function parseHashQuery(){
                var hash = window.location.hash,
                        pos = hash.indexOf('?'),
@@ -911,11 +915,11 @@ $(document).ready(function(){
                        dir = '/';
                // try and parse from URL hash first
                if (query){
-                       params = OC.parseQueryString(query);
+                       params = OC.parseQueryString(decodeQuery(query));
                }
                // else read from query attributes
                if (!params){
-                       params = OC.parseQueryString(location.search);
+                       params = OC.parseQueryString(decodeQuery(location.search));
                }
                return (params && params.dir) || '/';
        }