[MEDIA][MediaFile] Prevent issues with huge original filenames
This commit is contained in:
parent
4cc3a779b5
commit
1b69d02875
@ -326,7 +326,10 @@ class MediaFile
|
|||||||
$original_name = preg_replace('/\.+.+$/i', ".{$ext}", $original_name);
|
$original_name = preg_replace('/\.+.+$/i', ".{$ext}", $original_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
$enc_name = bin2hex($original_name);
|
// Avoid unnecessarily large file names
|
||||||
|
$pretty_name = substr(trim($original_name), 0, 30); // 30 seems like a sensible limit for a file name
|
||||||
|
|
||||||
|
$enc_name = bin2hex($pretty_name);
|
||||||
return "{$enc_name}-{$filehash}";
|
return "{$enc_name}-{$filehash}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user