Skip to content

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.php
index 9e3dd84a0..dceb92e79 100644
--- a/api/app/Service/Storage/StorageFileNameParser.php
+++ b/api/app/Service/Storage/StorageFileNameParser.php
@@ -30,7 +30,7 @@ class StorageFileNameParser
public 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 exceptions
return $fileName ? S3KeyCleaner::sanitize($fileName) : null;