Skip to content

Commit

Permalink
remove unicode control characters (e.g. soft hyphens) from filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
passchn committed Apr 16, 2023
1 parent a0b126d commit 11e54fa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Model/Table/AssetsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ public function initialize(array $config): void

$now = new FrozenTime();
$pathInfo = pathinfo((string)$data->getClientFilename());
$basename = preg_replace('#\p{C}+#u', '', $pathInfo['basename']);

This comment has been minimized.

Copy link
@passchn

passchn Apr 16, 2023

Author Collaborator

Screenshots from macOS may contain soft hyphens (e.g. "Bildschirm*foto" in german). This lead to an Exception in \League\Flysystem\WhitespaceNormalizer::rejectFunkyWhitespace() and the saving failed without any helpful information.


return $now->format('ymd') . '-' . $now->format('His') . '_' . $pathInfo['basename'];
return $now->format('ymd') . '-' . $now->format('His') . '_' . $basename;
},
'fields' => [
'dir' => 'directory',
Expand Down

0 comments on commit 11e54fa

Please sign in to comment.