Permalink
Browse files

Don’t urlencode '@2x', to have pretty IRIs (≈UTF8 URLs) in the browse…

…r address bar.
  • Loading branch information...
nedbaldessin committed Mar 3, 2017
1 parent a503a3b commit cbac286014c565ee588517ca06f90bd4dd4ab5c0
Showing with 7 additions and 0 deletions.
  1. +2 −0 engine/application/libraries/Filebrowser.php
  2. +5 −0 engine/application/libraries/Subfolio.php
@@ -492,11 +492,13 @@ public function get_link($name) {
if ($this->folder == "") {
$link = "/".urlencode($name);
$link = str_replace('%2F', '/', $link);
$link = str_replace('%40', '@', $link);
$link = Filebrowser::double_encode_specialcharacters($link);
} else {
$link = "/".urlencode($this->folder)."/".urlencode($name);
// unencode '/'
$link = str_replace('%2F', '/', $link);
$link = str_replace('%40', '@', $link);
$link = Filebrowser::double_encode_specialcharacters($link);
}
return $link;
@@ -1358,6 +1358,7 @@ public function parent_link($name) {
if ($ff <> '') {
$parent_link = urlencode(dirname($ff));
$parent_link = str_replace('%2F', '/', $parent_link);
$parent_link = str_replace('%40', '@', $parent_link);
// ## HACK FOR SLIDE
if (substr($parent_link, -6) == ".slide") {
$parent_link = substr($parent_link, 0, stripos($parent_link, '/'));
@@ -1381,6 +1382,7 @@ public function previous_link_or_span($name, $directory_name, $link_id, $class)
if ($prev <> "") {
$link = Filebrowser::double_encode_specialcharacters(urlencode($prev->name));
$link = str_replace('%2F', '/', $link);
$link = str_replace('%40', '@', $link);
return "<a id='$link_id' href='$link'>$name</a>";
} else {
return "<span id='$link_id' class='".$class."'>".$name."</span>";
@@ -1396,6 +1398,7 @@ public function previous_link_or_span($name, $directory_name, $link_id, $class)
if ($prev <> "") {
$link = Filebrowser::double_encode_specialcharacters(urlencode($prev->name));
$link = str_replace('%2F', '/', $link);
$link = str_replace('%40', '@', $link);
return "<a id='$link_id' href='$link'>$directory_name</a>";
} else {
@@ -1419,6 +1422,7 @@ public function next_link_or_span($name, $directory_name, $link_id, $class) {
if ($next <> "") {
$link = Filebrowser::double_encode_specialcharacters(urlencode($next->name));
$link = str_replace('%2F', '/', $link);
$link = str_replace('%40', '@', $link);
return "<a id='$link_id' href='$link'>$name</a>";
} else {
return "<span id='$link_id' class='".$class."'>".$name."</span>";
@@ -1434,6 +1438,7 @@ public function next_link_or_span($name, $directory_name, $link_id, $class) {
if ($next <> "") {
$link = Filebrowser::double_encode_specialcharacters(urlencode($next->name));
$link = str_replace('%2F', '/', $link);
$link = str_replace('%40', '@', $link);
return "<a id='$link_id' href='$link'>$directory_name</a>";
} else {

0 comments on commit cbac286

Please sign in to comment.