Junk Image Requests (v1)

With Aurelia v1, img tags are frequently sending requests before the src attributes are parsed. Eg

<img src="/images/${imgPath}.png">

sends a request for /images/$%7BimgPath%7D.png

How do I stop this short of using a service worker to detect bad characters in outgoing request URIs? Approximately 8% of requests to our CDN are junk because of this behavior.

1 Like

From this example gist Dumber Gist
I don’t see duplicate network requests for img.

Can you help create a repro based on that gist?

modified

Does it consistently in Safari 16.6 on mac0S 13.5.2

Using src.bind="`${src}`" seems to fix it.

this: src.bind="`${src}`"
can be simplefied to: src.bind="src"

2 Likes

thanks for the repro, i guess it’s an issue with webkit only, being truthful to the spec? whenever a new image attribute is assigned, fetch, regardless whether the url looks dubious or not :smiley:
Im not sure how to resolve this beside having the apps work it out themselves.

Oh right. This simplified from my use-case which includes other variables in the literal so wasn’t thinking about that

Yay Safari? :joy: Ended up just doing a bunch of src.bind=“path | once” and it’s working alright