From 95b9f4ed2325240411d4e349277c743aef06de6c Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Tue, 27 Dec 2011 12:35:29 -0500 Subject: Fix folder names with + characters in it --- files/js/fileactions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files/js') diff --git a/files/js/fileactions.js b/files/js/fileactions.js index 9e2688e82c1..4b90ab8cf49 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -137,7 +137,7 @@ FileActions.register('all','Rename',function(){return OC.imagePath('core','actio }); FileActions.register('dir','Open','',function(filename){ - window.location='index.php?dir='+$('#dir').val()+'/'+filename; + window.location='index.php?dir='+encodeURIComponent($('#dir').val())+'/'+encodeURIComponent(filename); }); FileActions.setDefault('dir','Open'); -- cgit v1.2.3 From 1cddfe8820b37eeca5c814ea9a48ebd3abab23ea Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Tue, 27 Dec 2011 12:43:58 -0500 Subject: Keep the urls pretty, decode forward slashes --- files/js/fileactions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files/js') diff --git a/files/js/fileactions.js b/files/js/fileactions.js index 4b90ab8cf49..6f0729e43b6 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -137,7 +137,7 @@ FileActions.register('all','Rename',function(){return OC.imagePath('core','actio }); FileActions.register('dir','Open','',function(filename){ - window.location='index.php?dir='+encodeURIComponent($('#dir').val())+'/'+encodeURIComponent(filename); + window.location='index.php?dir='+encodeURIComponent($('#dir').val()).replace(/%2F/g, '/')+'/'+encodeURIComponent(filename); }); FileActions.setDefault('dir','Open'); -- cgit v1.2.3 From 9b59bf40dff94c79cef45916c7ec6cf7d9835f14 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Wed, 28 Dec 2011 12:47:27 -0500 Subject: Fix encoding again and update the link after renaming files --- files/index.php | 2 +- files/js/filelist.js | 2 ++ files/templates/part.list.php | 10 +++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'files/js') diff --git a/files/index.php b/files/index.php index 189917150ad..fc69a42bec6 100644 --- a/files/index.php +++ b/files/index.php @@ -71,7 +71,7 @@ $breadcrumb = array(); $pathtohere = ""; foreach( explode( "/", $dir ) as $i ){ if( $i != "" ){ - $pathtohere .= "/".urlencode($i); + $pathtohere .= "/".str_replace('+','%20', urlencode($i)); $breadcrumb[] = array( "dir" => $pathtohere, "name" => $i ); } } diff --git a/files/js/filelist.js b/files/js/filelist.js index 16f73ed58d6..c8720d5a435 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -136,6 +136,8 @@ FileList={ var newname=input.val(); tr.attr('data-file',newname); td.children('a.name').empty(); + var path = td.children('a.name').attr('href'); + td.children('a.name').attr('href', path.replace(encodeURIComponent(name), encodeURIComponent(newname))); if(newname.indexOf('.')>0){ basename=newname.substr(0,newname.lastIndexOf('.')); }else{ diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 157ec4ef42c..ae3f32b2e9f 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -4,11 +4,15 @@ if($simple_size_color<0) $simple_size_color = 0; $relative_modified_date = relative_modified_date($file['mtime']); $relative_date_color = round((time()-$file['mtime'])/60/60/24*14); // the older the file, the brighter the shade of grey; days*14 - if($relative_date_color>200) $relative_date_color = 200; ?> - '> + if($relative_date_color>200) $relative_date_color = 200; + $name = str_replace('+','%20',urlencode($file['name'])); + $name = str_replace('%2F','/', $name); + $directory = str_replace('+','%20',urlencode($file['directory'])); + $directory = str_replace('%2F','/', $directory); ?> + '> - + -- cgit v1.2.3 From 86b65c269a858cfba953f49d7ac86a759865fcc3 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Wed, 28 Dec 2011 13:01:36 -0500 Subject: Keep the urls pretty, decode forward slashes for newly added directories --- files/js/filelist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files/js') diff --git a/files/js/filelist.js b/files/js/filelist.js index c8720d5a435..35847e06dfe 100644 --- a/files/js/filelist.js +++ b/files/js/filelist.js @@ -40,7 +40,7 @@ FileList={ html = $('').attr({ "data-type": "dir", "data-size": size, "data-file": name}); td = $('').attr({"class": "filename", "style": 'background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')' }); td.append(''); - var link_elem = $('').attr({ "class": "name", "href": "index.php?dir="+ encodeURIComponent($('#dir').val()+'/'+name) }); + var link_elem = $('').attr({ "class": "name", "href": "index.php?dir="+ encodeURIComponent($('#dir').val()+'/'+name).replace(/%2F/g, '/') }); link_elem.append($('').addClass('nametext').text(name)); td.append(link_elem); html.append(td); -- cgit v1.2.3