Search…

X3 Photo Gallery Support Forums

Search…
 
seldor
Topic Author
Posts: 8
Joined: 24 Oct 2022, 15:27

Images with + in name do not show

25 Oct 2022, 03:42

Hi
I have some images containing the character "+" in the name. Those images can be uploaded and edited in the admin panel but never show on the page.
The reason is, that the file names are not escaped when the URLs are composed. But "+" in an URL has a special meaning: for historical reasons, this is treated as a space (exactly like %20). So when composing the URLs, all file names must be correctly encoded to be used in a file path.
Renaming them in X3 and removing the plus solves the issue but should ideally not be necessary.
Thanks
Matt
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14143
Joined: 30 Sep 2006, 03:37

Re: Images with + in name do not show

25 Oct 2022, 04:34

For reference, when you say "never show on the page", do you mean they don't display at all? Or the image fails to load into place? Thanks.
 
seldor
Topic Author
Posts: 8
Joined: 24 Oct 2022, 15:27

Re: Images with + in name do not show

27 Oct 2022, 02:46

On a gallery, just an endless loading spinner appears. In the admin panel, everything works as expected.

The reason it fails in the gallery view is, that the image is tried to be loaded using an url like:
https://domain/x3/render/w640-c1.1/album/IMG_10228+.jpg  (which treats the + like a space by the server)
Or when clicking on it, the url would be:
https://domain/x3/render/w1024/album/IMG_10228+.jpg  (with the same problem)

The generated HTML is also wrong (and probably the main reason) in this case: (in the href and data-image, the "+" should be encoded as %2B
Code
<a class="item img-link item-link x3-popup" data-width="2048" data-height="1365" data-image="/x3/content/album/IMG_10228+.jpg" data-title="" data-name="IMG 10228+" data-description="" data-date="25.10.2022" href="/x3/album/IMG_10228+/" id="image-img-10228" itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14143
Joined: 30 Sep 2006, 03:37

Re: Images with + in name do not show

27 Oct 2022, 04:31

I'll look into it for next release. Keep in mind, we do restrict these characters when renaming or creating files and folders in X3, because some characters are not supported, while others (like +) have ambiguous meaning. On some servers, + is interpreted as empty space, although empty space is encoded to something else.

Anyway, definitely room for improvement, as all characters are resolved correctly in our newer files.gallery app.

Thanks for reporting!
 
seldor
Topic Author
Posts: 8
Joined: 24 Oct 2022, 15:27

Re: Images with + in name do not show

27 Oct 2022, 11:06

Alright, thanks! A good solution might also be to just replace such characters on upload so that such files cannot ever get into the system (easily).
 
User avatar
mjau-mjau
X3 Wizard
Posts: 14143
Joined: 30 Sep 2006, 03:37

Re: Images with + in name do not show

12 Sep 2023, 06:31

This was fixed in X3.32.0. See release post:
photo.gallery/blog/photo-gallery-x3-32/
 
seldor
Topic Author
Posts: 8
Joined: 24 Oct 2022, 15:27

Re: Images with + in name do not show

12 Sep 2023, 06:34

Thanks ! Will try it out soon