Skip to content

Commit 7484a0e

Browse files
authored
Fix decode filename (Webklex#535)
1 parent 861557c commit 7484a0e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Attachment.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ public function decodeName(?string $name): string {
307307
if (str_contains($name, "''")) {
308308
$parts = explode("''", $name);
309309
if (EncodingAliases::has($parts[0])) {
310+
$encoding = $parts[0];
310311
$name = implode("''", array_slice($parts, 1));
311312
}
312313
}
@@ -323,6 +324,10 @@ public function decodeName(?string $name): string {
323324
$name = urldecode($name);
324325
}
325326

327+
if (isset($encoding)) {
328+
$name = EncodingAliases::convert($name, $encoding);
329+
}
330+
326331
// sanitize $name
327332
$replaces = [
328333
'/\\\\/' => '',

0 commit comments

Comments
 (0)