Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: DenDen60 on April 30, 2022, 07:27:26 AM

Title: a space in the url brakes the link to the image.
Post by: DenDen60 on April 30, 2022, 07:27:26 AM
I had a cartoon that I wanted to be published.

When I used this URL: 

https://citizensandsocieties.org/Community/images/cartoons/when workers unite.jpg

I could see the image in the message I was writing, but when I posted it, it wouldn't show. I would then click on modify, and I would see the image again. 

I tried changing the name of the file to

 "when_workers_unite.jpg", 

thus getting rid of the spaces, and it worked. I could see both the image as I was creating my message and after I posted it.  
Title: Re: a space in the url brakes the link to the image.
Post by: Aleksi "Lex" Kilpinen on April 30, 2022, 07:31:37 AM
Spaces really shouldn't be used in web accessible files or folders. You can if you need to though, browsers should understand %20 as a space. For example:
https://citizensandsocieties.org/Community/images/cartoons/when%20workers%20unite.jpg (https://citizensandsocieties.org/Community/images/cartoons/when%20workers%20unite.jpg)
Title: Re: a space in the url brakes the link to the image.
Post by: DenDen60 on April 30, 2022, 07:45:14 AM
Quote from: Aleksi on April 30, 2022, 07:31:37 AMSpaces really shouldn't be used in web accessible files or folders. You can if you need to though, browsers should understand %20 as a space. For example:
https://citizensandsocieties.org/Community/images/cartoons/when%20workers%20unite.jpg (https://citizensandsocieties.org/Community/images/cartoons/when%20workers%20unite.jpg)
I understand. 

This being said, if a newbie, and my participants will be newbies, ;-) sees his image as he is  writing it in a post, then it disappears when he publishes it, he won't understand what happened.

From my point of view, either the software does not show an image when there are spaces in a URL when someone is writing a message ior it transforms spaces automatically into %20 when "Preview" or "Post" is clicked . 
Title: Re: a space in the url brakes the link to the image.
Post by: Arantor on April 30, 2022, 10:53:34 AM
The software is doing the correct thing, it's not going to be changed, because it's not wrong.

Don't put spaces in the file names of your images in the first place.
Title: Re: a space in the url brakes the link to the image.
Post by: DenDen60 on April 30, 2022, 11:25:01 AM
Quote from: Arantor on April 30, 2022, 10:53:34 AMThe software is doing the correct thing, it's not going to be changed, because it's not wrong.

Don't put spaces in the file names of your images in the first place.
You are of course entitle to your opinion, and although you are technically right, when you make an analysis on the basis of user-friendliness, the software could be improved. 
Title: Re: a space in the url brakes the link to the image.
Post by: shawnb61 on April 30, 2022, 11:32:25 AM
Issue logged:
https://github.com/SimpleMachines/SMF2.1/issues/7441

Note this works fine in 2.0, but fails in 2.1. Not sure what changed.  Worth looking into.
Title: Re: a space in the url brakes the link to the image.
Post by: Aleksi "Lex" Kilpinen on April 30, 2022, 11:57:49 AM
Well, as As per RFC 1738 URLs must not contain literal spaces.
Title: Re: a space in the url brakes the link to the image.
Post by: DenDen60 on April 30, 2022, 01:32:58 PM
Quote from: Aleksi on April 30, 2022, 11:57:49 AMWell, as As per RFC 1738 URLs must not contain literal spaces.
Most users are not aware of  RFC 1738. ;-) Hence, since it is possible to transform a URL so that spaces are transformed into html code, wouldn't it be a good usability measure to automatically do this? I think it would, especially since users are able to see the image as they write their message even if the URL has spaces.   
Title: Re: a space in the url brakes the link to the image.
Post by: Aleksi "Lex" Kilpinen on April 30, 2022, 01:35:38 PM
I agree it could be useful, if it can be easily achieved.
Title: Spaces (not "%20") in URLs removed.
Post by: Geremia16 on May 07, 2022, 06:30:25 PM
With SMF 2.1.1, I started getting the issue where URLs with spaces (not with "%20") are rendered as URLs with the spaces deleted. For example, the TestSite link of:
[url="https://testsite.com/Something with a space.html"]TestSite[/url]actually points to: TestSite (https://testsite.com/Something%20with%20a%20space.html) (the URL with spaces deleted)

However,
[url="https://testsite.com/Something%20with%20a%20space.html"]TestSite[/url]works: TestSite (https://testsite.com/Something%20with%20a%20space.html) (the URL with spaces retained)

Is there a way to rewrite all URLs so they have "%20" instead of spaces?
Title: Re: a space in the url brakes the link to the image.
Post by: Geremia16 on May 08, 2022, 05:33:31 PM
With SMF 2.1.1, pasting rich-text with hyperlinks into the textarea then clicking the "Toggle source view" button strips all the hyperlinks. This didn't happen when I was running SMF 2.1 RC4, either.

"Toggle source view" strips hyperlinks in pasted rich-text #7455 (https://github.com/SimpleMachines/SMF2.1/issues/7455)
Title: Spaces in URLs cause issues #7441
Post by: Geremia16 on May 08, 2022, 05:54:54 PM
Spaces in URLs cause issues #7441 (https://github.com/SimpleMachines/SMF2.1/issues/7441)

There's a Pull Request: Supports URLs with spaces in BBC params #7450 (https://github.com/SimpleMachines/SMF2.1/pull/7450/files).
Title: Re: a space in the url brakes the link to the image.
Post by: shawnb61 on November 25, 2022, 03:40:19 PM
Fixed in 2.1.3.