Skip to content
Snippets Groups Projects
Unverified Commit f96fff0d 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

(cherry picked from commit ec3fedad)
parent 2e879e5a
No related branches found
No related tags found
14 merge requests!11515Issue #3480419 by mondrake, smustgrave, catch: Method...,!11380Issue #3490698 by catch, spokje: Bump MINIMUM_STABILITY back to 'stable' when...,!11281Use Drupal Core Leadership terminology in MAINTAINERS.txt,!11239Issue #3507548: Allow workspace changes listing to show all items, without a pager,!11238Fix issue #3051797,!11213Issue #3506743 by tomislav.matokovic: Increasing the color contrast for the navigation block title against the background of the navigation sidebar to at least 4.5:1,!11147Draft: Try to avoid manually setting required cache contexts,!11108Issue #3490298 by nicxvan: Profiles can be missed in OOP hooks,!11093Drupal on MongoDB 11.1.x,!11017Issue #3502540: Add date filter for moderated content.,!11009Issue #3486972 migrate feed icon,!10999Cleaning up Taxonomy hooks and updating baseline.,!10977Issue #3501457: Fix path used in a A11y Test Admin,!10881Issue #3489329 by mfb, casey: symfony/http-foundation commit 32310ff breaks PathValidator
Pipeline #394301 passed
Pipeline: drupal

#394302

    ......@@ -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