News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

SMF 2.1.1 directories with spaces break image display

Started by ForumKlaus, February 15, 2022, 03:43:05 PM

Previous topic - Next topic

ForumKlaus

I upgraded today (15 Feb 2022) from SMF 2.0.19 to 2.1.1

In the body of a post I have an image tag

[img]https://www.dav-bw-forum.de/panorama2022/2022_02_13 Seeg - 3-Seen-Tour/0213-120534.jpg[/img]
The rendered page does not display the image because the resulting html is:

<img src="https://www.dav-bw-forum.de/panorama2022/2022_02_13Seeg-3-Seen-Tour/0213-120556_stitch.jpg" alt="" class="bbc_img resized" loading="lazy" width="1024" height="164">

The spaces in the directory are gone  :(

See the result for yourself at
https://www.dav-bw-forum.de/forum/index.php?topic=958

Arantor

Spaces are generally a really bad idea in URLs - I'd honestly suggest renaming your files to something without them.

Antechinus

Spaces in directory names can even cause issues with directories in Windows on desktop, let alone running live on the web. Why would you put spaces in directory names? Use underscores, or hyphens. That's standard practice.

Aleksi "Lex" Kilpinen

You would need to replace spaces with %20 to make it work
example:
[img]https://www.dav-bw-forum.de/panorama2022/2022_02_13%20Seeg%20-%203-Seen-Tour/0213-120534.jpg[/img]
But like already mentioned, it's simply better to just avoid spaces to begin with.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

ForumKlaus

Hi all,

The workaround with %20 instead a space works

Thank you.

But I can't edit all my posts.

Arantor

Reverting the behaviour to SMF 2.0 style bbcode isn't really viable either (because it breaks in other subtle ways if you're not careful and even if you are)

Antechinus

Quote from: ForumKlaus on February 15, 2022, 04:51:25 PMHi all,

The workaround with %20 instead a space works
Yes, it will work, but it's messier and more difficult to read, and it also means more superfluous characters. Which is why people use underscore and/or hyphens. Easier to type, less clutter, easier to read.

QuoteBut I can't edit all my posts.
You can run an SQL query on the database, to find and replace all instances of the relevant directory names.

m4z

Btw, this is called URL- or Percent-Encoding and has nothing to do with SMF. It's just part of the rules of how URLs (simplified: web links) have to look like.
"Faith is what you have in things that don't exist."
--Homer Simpson

Es gibt hier im Forum ein deutsches Support-Board!

Arantor

Yes but previously SMF handled this very slightly differently such that the original use case - while not recommended at all - would actually work. This has been changed for unrelated reasons in SMF and now breaks, but reverting the specific change is difficult to do and the correct approach is to make the folder names normalised.

Since the code removes the spaces all that would need to happen is rename the folders to match...

Advertisement: