Skip to content
Snippets Groups Projects
Unverified Commit ec3fedad authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3466462 by mfb, chandansha, kim.pepper, charlliequadros, smustgrave,...

Issue #3466462 by mfb, chandansha, kim.pepper, charlliequadros, smustgrave, mxr576, quietone, morvaim, larowlan: Fix handling of unknown file extensions in FileMediaFormatterBase
parent c9888317
No related branches found
No related tags found
4 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,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!617Issue #3043725: Provide a Entity Handler for user cancelation
Pipeline #393547 passed with warnings
Pipeline: drupal

#393560

    Pipeline: drupal

    #393555

      Pipeline: drupal

      #393549

        ......@@ -81,7 +81,7 @@ public static function isApplicable(FieldDefinitionInterface $field_definition)
        foreach ($extension_list as $extension) {
        $mime_type = $extension_mime_type_guesser->guessMimeType('fakedFile.' . $extension);
        if (static::mimeTypeApplies($mime_type)) {
        if ($mime_type !== NULL && static::mimeTypeApplies($mime_type)) {
        return TRUE;
        }
        }
        ......@@ -192,11 +192,12 @@ protected function getSourceFiles(EntityReferenceFieldItemListInterface $items,
        // grouping in case the multiple file behavior is not 'tags'.
        /** @var \Drupal\file\Entity\File $file */
        foreach ($this->getEntitiesToView($items, $langcode) as $file) {
        if (static::mimeTypeApplies($file->getMimeType())) {
        $mime_type = $file->getMimeType();
        if ($mime_type !== NULL && static::mimeTypeApplies($mime_type)) {
        $source_attributes = new Attribute();
        $source_attributes
        ->setAttribute('src', $file->createFileUrl())
        ->setAttribute('type', $file->getMimeType());
        ->setAttribute('type', $mime_type);
        if ($this->getSetting('multiple_file_display_type') === 'tags') {
        $source_files[] = [
        [
        ......
        ......@@ -24,7 +24,8 @@ class FileAudioFormatterTest extends FileMediaFormatterTestBase {
        * @dataProvider dataProvider
        */
        public function testRender($tag_count, $formatter_settings): void {
        $field_config = $this->createMediaField('file_audio', 'mp3', $formatter_settings);
        // Create a file field that accepts .mp3 and an unknown file extension.
        $field_config = $this->createMediaField('file_audio', 'unknown-extension, mp3', $formatter_settings);
        file_put_contents('public://file.mp3', str_repeat('t', 10));
        $file1 = File::create([
        ......
        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