Skip to content

Commit

Permalink
fix bug when filename is composed of non-latin charaters #473
Browse files Browse the repository at this point in the history
  • Loading branch information
simogeo committed Mar 17, 2016
1 parent 138aaf1 commit 4dc16b0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
7 changes: 7 additions & 0 deletions connectors/php/filemanager.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,13 @@ private function cleanString($string, $allowed = array()) {
$cleaned = preg_replace('/[_]+/', '_', $clean); // remove double underscore

}

// prevent bug https://github.com/simogeo/Filemanager/issues/474
$path_parts = pathinfo($cleaned);
if(empty($path_parts['filename'])) {
$path_parts['filename'] = "unsupportedCharsReplacement";
$cleaned = $path_parts['filename'] . '.' . $path_parts['extension'] ;
}
return $cleaned;
}

Expand Down
2 changes: 2 additions & 0 deletions scripts/filemanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ var cleanString = function(str) {
}

cleaned = cleaned.replace(/[_]+/g, "_");
// prevent bug https://github.com/simogeo/Filemanager/issues/474
if(cleaned == "") cleaned = "unsupportedCharsReplacement";

return cleaned;
};
Expand Down
8 changes: 4 additions & 4 deletions scripts/filemanager.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4dc16b0

Please sign in to comment.