Problem/Motivation

I'm migrating from media_acquiadam to acquia_dam.

I already ran into this issue on the problems of migrating a catch-all media type into the acquia_dam framework: #3565073: Migration to acquia_dam module fails for media type that references pdf and other files

While that new drush command is great, I was hoping to just use the "Acquia DAM: Generic" plugin for the "asset source type". This was actually recommended by Acquia support and I convinced myself tit was the easiest approach.

wishful thinking

Except I realized this won't work. The "Acquia DAM: Generic" AssetMediaSource plugin only works if the media type is named acquia_dam_generic_asset. That because the media solver has that media type hardcoded:

    // 3. Finally fallback to the 'Generic' media type as a last resort.
    return $result ?? $this->entityTypeManager->getStorage('media_type')->load('acquia_dam_generic_asset');

It should instead hardcode the asset type and figure out what media type uses that asset type in its source plugin.

Steps to reproduce

Try to use the Acquia DAM: Generic asset type for a media type that isn't named acquia_dam_generic_asset.

The media type resolver will never resolve anything to your generic media type.

That is unless the files in the dam happen to meet the search criterion ft:{'generic_binary'}. But that's not really what we're looking for is it.

Proposed resolution

The media type resolver should instead hardcode the asset type and figure out what media type uses that asset type in its source plugin.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork acquia_dam-3571816

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

danflanagan8 created an issue. See original summary.

danflanagan8’s picture

Priority: Normal » Major

I'm calling this a major bug because it prevents me from migrating my site based on Acquia support's help.

danflanagan8’s picture

Status: Active » Needs work
Issue tags: +Needs tests

I opened an MR that I think should work. I still want to dd a test.

danflanagan8’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests

The kernel test for the media type resolver started failing because in that test the generic media type is not named acquia_dam_generic_asset! So that acts a lot like our fail test, proving that this wasn't really working before.

I've updated a couple null assertions in that test to expect the generic media type instead.

Hopefully none of the other tests fail. That's the only one I ran locally.

pavlosdan’s picture

Just chiming in to say that we noticed the generic asset type stop working as well during the migration which is also a blocker for us.

rajeshreeputra made their first commit to this issue’s fork.

rajeshreeputra’s picture

Status: Needs review » Fixed

Merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.