From: Vincent Petry Date: Fri, 20 Sep 2013 19:52:40 +0000 (+0200) Subject: Replace plus sign with space in files app URL #4932 X-Git-Tag: v6.0.0alpha2~99^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1962bed261c0124e2d0372bb093c16a510a8f102;p=nextcloud-server.git Replace plus sign with space in files app URL #4932 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. --- diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 4fc1b95a0ab..3c99e3876c7 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -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) || '/'; }