From 1962bed261c0124e2d0372bb093c16a510a8f102 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 20 Sep 2013 21:52:40 +0200 Subject: [PATCH] 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. --- apps/files/js/filelist.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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) || '/'; } -- 2.39.5