Skip to content
Snippets Groups Projects
Verified Commit 393baa76 authored by Dave Long's avatar Dave Long
Browse files

Issue #3487488 by kim.pepper, mondrake, dakwamine, smustgrave:...

Issue #3487488 by kim.pepper, mondrake, dakwamine, smustgrave: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) in the extension parts like foo.0.zip
parent 58be5f12
Branches
No related tags found
10 merge requests!11197Issue #3506427 by eduardo morales alberti: Remove responsive_image.ajax from hook,!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!10786Issue #3490579 by shalini_jha, mstrelan: Add void return to all views...,!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!617Issue #3043725: Provide a Entity Handler for user cancelation
......@@ -915,7 +915,9 @@ public function guessMimeType($path): ?string {
// 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));
if (isset($this->mapping['extensions'][$extension])) {
return $this->mapping['mimetypes'][$this->mapping['extensions'][$extension]];
......
......@@ -44,6 +44,8 @@ public function testFileMimeTypeDetection(): void {
'foobar.z' => 'application/x-compress',
'foobar.tar' => 'application/x-tar',
'foobar.tar.z' => 'application/x-tarz',
'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.
Please register or to comment