forked from GNUsocial/gnu-social
[MEDIA][MediaFile] Prevent issues with huge original filenames
This commit is contained in:
parent
bb2c845f62
commit
066dfbb66d
@ -326,7 +326,10 @@ class MediaFile
|
||||
$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}";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user