[Embed][CORE] Fixes 'Invalid Filename' on Embed. Regex didn't get updated
This commit is contained in:
parent
0fac7e49e2
commit
e25803b537
|
@ -272,14 +272,17 @@ class MediaFile
|
||||||
*/
|
*/
|
||||||
public static function decodeFilename(string $encoded_filename)
|
public static function decodeFilename(string $encoded_filename)
|
||||||
{
|
{
|
||||||
// The x is because it is using in thumbnails
|
// Should match:
|
||||||
$ret = preg_match('/^([^-x]+?)-[^-]+$/', $encoded_filename, $matches);
|
// hex-hash
|
||||||
|
// thumb-id-widthxheight-hex-hash
|
||||||
|
// And return the `hex` part
|
||||||
|
$ret = preg_match('/^(.*-)?([^-]+)-[^-]+$/', $encoded_filename, $matches);
|
||||||
if ($ret === false) {
|
if ($ret === false) {
|
||||||
return false;
|
return false;
|
||||||
} elseif ($ret === 0) {
|
} elseif ($ret === 0) {
|
||||||
return null; // No match
|
return null; // No match
|
||||||
} else {
|
} else {
|
||||||
$filename = hex2bin($matches[1]);
|
$filename = hex2bin($matches[2]);
|
||||||
|
|
||||||
// Matches extension
|
// Matches extension
|
||||||
if (preg_match('/^(.+?)\.(.+)$/', $filename, $sub_matches) === 1) {
|
if (preg_match('/^(.+?)\.(.+)$/', $filename, $sub_matches) === 1) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user