Skip to content
Snippets Groups Projects
Commit 6e87cd88 authored by Chandansha Fakir's avatar Chandansha Fakir Committed by mondrake
Browse files

Issue #3487753 by chandansha, lavanyatalwar: Support file names with "0" (zero) like foo.0.zip

parent 19f55381
No related branches found
No related tags found
1 merge request!27Added foo.0.zip
Pipeline #370993 passed
......@@ -39,7 +39,9 @@ class SophronMimeTypeGuesser implements MimeTypeGuesserInterface {
// then iterate over the file parts, trying to find a match.
// For 'my.awesome.image.jpeg', we try: 'awesome.image.jpeg', then
// 'image.jpeg', then 'jpeg'.
while (array_shift($file_parts)) {
// We explicitly check for NULL because that indicates that the array is
// empty.
while (array_shift($file_parts) !== NULL) {
$extension = strtolower(implode('.', $file_parts));
$mime_map_extension = $this->mimeMapManager->getExtension($extension);
try {
......
......@@ -96,6 +96,8 @@ class SophronGuesserTest extends KernelTestBase {
'foo.file_test_2' => 'application/octet-stream',
'foo.doc' => 'application/msword',
'test.ogg' => 'audio/ogg',
'foobar.0.zip' => 'application/zip',
'foobar..zip' => 'application/zip',
];
$guesser = $this->container->get('file.mime_type.guesser');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment