Avoid invalid image request in Firefox caused by the template.
Firefox is the only browser that processes the contents of tags and attempts to load the image referenced with src="{url}". This results in a 404 response, and because my server is configured with Fail2Ban to block repeated 404 requests, Firefox ends up banning me from my own server.
This issue occurs only in Firefox—Chrome and other browsers ignore the contents of elements as expected.
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.
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.
Could you please explain in more detail how I can reproduce the issue?
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.
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.
The video:
https://github.com/user-attachments/assets/95f189c2-b5cb-4491-80ac-c300a8f0a023 (wetransfer: https://we.tl/t-dwGWq6ZwWU)
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.
close https://github.com/orchidsoftware/platform/pull/3064