Skip to content

feat: use media route#588

Open
kptdobe wants to merge 6 commits into
mainfrom
media
Open

feat: use media route#588
kptdobe wants to merge 6 commits into
mainfrom
media

Conversation

@kptdobe
Copy link
Copy Markdown
Contributor

@kptdobe kptdobe commented Oct 2, 2025

Use the new /media route - see adobe/da-admin#178

Note: only merge this one when adobe/da-admin#178 has been deployed to production.

Test: https://media--da-live--adobe.aem.live/?da-admin=stage

UX in case of error (like if image is > 20MB) needs to be reviewed.

@kptdobe kptdobe requested a review from auniverseaway October 2, 2025 09:51
@aem-code-sync
Copy link
Copy Markdown

aem-code-sync Bot commented Oct 2, 2025

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@aem-code-sync
Copy link
Copy Markdown

aem-code-sync Bot commented Oct 2, 2025

Page Scores Audits Google
📱 /?da-admin=stage PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /?da-admin=stage PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@auniverseaway
Copy link
Copy Markdown
Member

I really like this, but its probably something we should do during the Helix6 / DA2 cycle... I get the problem at hand, so if we cannot come up with a solution with fewer tradeoffs, we should carry this out.

I know why it needs to exist, but creating a media route seems needlessly tedious to the API consumer. A developer should be able to upload to source and we figure it out where it needs to go. We know what the mime type is so we know if it should go to Media Bus. I don't want us in the same mess as Content Bus / Media Bus where something can live in either place (ala SVG). There should be one code path to get a source file into DA and we decide where it needs to live in the repository.

This obviously works where we do not care where these files live, but it also creates a fork in implementations where if I upload a file direct (drag and drop in browse), its a different code path... these are back to living in DA. I would like us to use Media Bus e2e if we're going to use Media Bus as our asset store.

Potential paths forward

  1. Update the source API
    1. Source API detects the extension / mime type and correctly routes the image to Media Bus.
    2. We need to be able to have a ref for direct uploads... if I upload to /org/site/random/my-image.jpg it needs to map back to a Media Bus hash. Yes, a bigger lift.
    3. We determine what we put in the doc that is relatively consistent with the other use case. The dot convention seemed fine, but I also wouldn't be opposed to something else that's more transparent / stable... /media/... even.
  2. Re-route doc drops
    1. Instead of dropping into a dot folder, we place these somewhere like /media/path-of-current/page/my-image.jpg. Page moves would not break any more. Problem is solved.
    2. We push this problem to be solved with Helix6 / DA2.
  3. Any other ideas?

@kptdobe
Copy link
Copy Markdown
Contributor Author

kptdobe commented Oct 14, 2025

We can definitively think the "API routes" differently.
I have created the /media API end point just because it is an upload service and not a proper REST API.
We could definitively use /source with a minimum of intelligence. If you upload an asset to /org/site/a/b/c/my-image.jpg, you get: /org/site/media_id.jpg as a response uri. That's the most stable path we can use.

Side note: /org/site/a/media_id.jpg, /org/site/a/b/media_id.jpg, /org/site/a/b/c/media_id.jpg or /org/site/x/y/z/media_id.jpg would work too. Which is an implementation detail but helps to use relative paths and avoid all complicated asset references. /stable or /media would work too but is this really necessary ? (especially all assets would be like /media/media_...)

@auniverseaway
Copy link
Copy Markdown
Member

I'd love to get this shipped somehow. Aside from the merge conflict, I think this only needs a few graceful fallbacks to cut down on support issues:

Motivation: this change will have the following impact to the existing process:

  1. You cannot upload bigger than 20MB.
  2. You cannot upload unless you're in a legitimate Edge Delivery site.
    1. no uploads to org level.
    2. no uploads before Edge Delivery site made.
  3. You cannot upload unless you have basic_author permissions for Edge Delivery.

How I'd solve (happy to take other suggestions)
For no images above 20MB - throw the modal. They can't get the image out the door anyway.

For org-level uploads - throw the modal. Let's see who it impacts.

For no site === no upload or no basic_author === no upload - graceful fallbacks:

  1. Try to upload /{org}/{site}/media/{original-drop-parent-path}/{something-unique}.png.
  2. Fallback to original behavior + sanitized name if the author cannot access /{org}/{site}/media for whatever reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants