Verified Commit 61cc0660 authored by Dave Long's avatar Dave Long Committed by Jess
Browse files

Issue #3156672 by kim.pepper, joegraduate, longwave, PieterDC, smustgrave,...

Issue #3156672 by kim.pepper, joegraduate, longwave, PieterDC, smustgrave, tstoeckler, alexpott: ExtensionMimeTypeGuesser breaks other mime_type_guesser services

(cherry picked from commit cc9baee9)
(cherry picked from commit 2d42a30b)
parent 187c2bf4
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -926,7 +926,7 @@ public function guessMimeType($path): ?string {
      }
    }

    return 'application/octet-stream';
    return NULL;
  }

  /**
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ public function guessMimeType(string $path) : ?string {
      }
    }

    return NULL;
    return 'application/octet-stream';
  }

  /**
+9 −9
Original line number Diff line number Diff line
@@ -69,18 +69,18 @@ public function testFileMimeTypeDetection(): void {

    $test_case = [
      'test.jar' => 'application/java-archive',
      'test.jpeg' => 'application/octet-stream',
      'test.jpeg' => NULL,
      'test.jpg' => 'image/jpeg',
      'test.jar.jpg' => 'image/jpeg',
      'test.jpg.jar' => 'application/java-archive',
      'test.pcf.z' => 'application/octet-stream',
      'pcf.z' => 'application/octet-stream',
      'jar' => 'application/octet-stream',
      'some.junk' => 'application/octet-stream',
      'foo.file_test_1' => 'application/octet-stream',
      'foo.file_test_2' => 'application/octet-stream',
      'foo.doc' => 'application/octet-stream',
      'test.ogg' => 'application/octet-stream',
      'test.pcf.z' => NULL,
      'pcf.z' => NULL,
      'jar' => NULL,
      'some.junk' => NULL,
      'foo.file_test_1' => NULL,
      'foo.file_test_2' => NULL,
      'foo.doc' => NULL,
      'test.ogg' => NULL,
    ];
    $extension_guesser = $this->container->get('file.mime_type.guesser.extension');
    $extension_guesser->setMapping($mapping);