Skip to content

Commit

Permalink
correct filename if the filename is NON UTF-8
Browse files Browse the repository at this point in the history
  • Loading branch information
shamsbd71 authored Jan 15, 2021
1 parent 15d5b2c commit 6d38dd6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Plugins/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,16 @@ public function fetch_list()
*/
private function prepareList(&$list)
{
/**
* @issue Make PHP pathinfo() return the correct filename if the filename is UTF-8
* @url https://stackoverflow.com/questions/4451664/make-php-pathinfo-return-the-correct-filename-if-the-filename-is-utf-8
*/
setlocale(LC_ALL, 'en_US.UTF-8');

$list = array_values(array_filter($list, function ($item) {
return ! in_array(basename($item), ['.', '..']);
}));

array_walk($list, function (&$item, $key) {
$info = pathinfo($item);
unset($info['dirname']);
Expand Down Expand Up @@ -608,4 +615,4 @@ public static function methods()
"delete"
];
}
}
}

0 comments on commit 6d38dd6

Please sign in to comment.