Beautiful Open-Source Form Builder
Refactor file name handling in StorageFileNameParser (#955)
Chirag Chhatrala0ddaf0118bb0
diff --git a/api/app/Service/Storage/StorageFileNameParser.php b/api/app/Service/Storage/StorageFileNameParser.phpindex 9e3dd84a0..dceb92e79 100644--- a/api/app/Service/Storage/StorageFileNameParser.php+++ b/api/app/Service/Storage/StorageFileNameParser.php@@ -30,7 +30,7 @@ class StorageFileNameParserpublic function getMovedFileName(): ?string{if ($this->fileName && $this->extension) {- $fileName = substr($this->fileName, 0, 50) . '_' . $this->uuid . '.' . $this->extension;+ $fileName = mb_substr($this->fileName, 0, 50) . '_' . $this->uuid . '.' . $this->extension;$fileName = preg_replace('#\p{C}+#u', '', $fileName); // avoid CorruptedPathDetected exceptionsreturn $fileName ? S3KeyCleaner::sanitize($fileName) : null;