platform icon indicating copy to clipboard operation
platform copied to clipboard

Avoid invalid image request in Firefox caused by the template.

Open bandicsongor opened this issue 1 month ago • 5 comments

Firefox is the only browser that processes the contents of

This issue occurs only in Firefox—Chrome and other browsers ignore the contents of

Solution: I initialized the template’s image with a 1-pixel transparent placeholder and then set the real URL via a query selector instead of performing a string replace on innerHTML. I also added an alt attribute to the image.

bandicsongor avatar Nov 16 '25 15:11 bandicsongor

I tried uploading and deleting images in Attach both in multiple mode and single mode. I tested it in Firefox 145.0 (aarch64) and I’m not seeing any 404 errors.

image

Could you please explain in more detail how I can reproduce the issue?

tabuna avatar Nov 17 '25 08:11 tabuna

I’ll try to reproduce the issue in the next couple of days. Please allow me 1–2 days and I’ll get back to you with the results.

bandicsongor avatar Nov 20 '25 09:11 bandicsongor

It kept bothering me, so I jumped back into it, and I ran into something very interesting. It only makes that invalid request when I add an input parameter to the query method.

What you can see in the video:

  • on every refresh there is a /{url} request
  • when I remove the parameter from the query() method, it no longer makes this request
  • when I put it back, it starts doing it again

I tested it, and it doesn’t depend on the model—no matter which model I used, I observed the same behavior. I’m attaching the video and the files as well.

platform.php: Route::screen('/test/{dataFeed}', \App\Orchid\Screens\TestScreen::class)->name('state');

Uploading Screen Recording 2025-11-20 at 13.22.56.mov… TestScreen.php DataFeed.php

PS: I didn’t try to find out where the problem comes from; unfortunately, I don’t have time for that right now.

bandicsongor avatar Nov 20 '25 11:11 bandicsongor

The video:

https://github.com/user-attachments/assets/95f189c2-b5cb-4491-80ac-c300a8f0a023 (wetransfer: https://we.tl/t-dwGWq6ZwWU)

bandicsongor avatar Nov 20 '25 11:11 bandicsongor

I was able to reproduce this both in the latest version and in the master branch.

It looks like the issue is related to how Firefox handles the <template> element, trying to load all the resources inside it. This doesn’t seem to be the expected behavior, there are similar discussions, for example: https://support.mozilla.org/en-US/questions/1229317

Fortunately, for images, this is easy to fix: you just need to add the loading="lazy" attribute.

<img class="attach-image rounded border user-select-none overflow-hidden"
     src="{url}"
     loading="lazy"
     title="{original_name}"/>

You can update your PR? Ideally, please target the 14.x branch so that I can make a release without waiting for all the planned tasks for 15.x (master) to be completed.

tabuna avatar Nov 20 '25 13:11 tabuna

close https://github.com/orchidsoftware/platform/pull/3064

tabuna avatar Dec 17 '25 23:12 tabuna