Link to images in form view creates wrong url

cn flag

I noticed this after drupal 9 update, but I've tried to find the exact moment when it was broken and I couldn't find it. I use S3 and cloudfront for images so maybe the problem is related with that config.

Apparently, the images work well (that's why I didn't realize it was broken). Images load correctly in my frontend and even the little preview in the backend is correctly shown. The problem is the link to the original file.

Backend aspect when uploading pictures

For instance, as you can see, the twitter image is working correctly (it's been shown in the backend) but if I follow the "twitter.jpg" link above the image, it sends me to:

<a href="/https%3A//" type="image/jpeg">twitter.jpg</a>

The big problem is it's adding a "/" before the image link itself and instead of just using the url itself. On top of that, it's writing a "url-safe" so the "https://" is transformed into "htttps%3A//".

According to debug, it's using this template and I don't see anything strange in it (I tried a different theme too, but still failed):

<!-- BEGIN OUTPUT from 'core/themes/claro/templates/field/file-link.html.twig' -->

Any idea on what can be causing this?

cn flag
Check S3/cloud front module, if that is doing a pre-processing
sa flag

I think your issue is the same as the one described here:

It seems to be fixed now with this commit:

If the Drupal core update will not help you, try to use some of the working patches in the issue thread temporary until Drupal core itself will not fix this issue for you.

zapico avatar
cn flag
Thanks a lot!!! It really seems the exact problem, but I think I'll wait until next patch release to install it :)

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.