[Gambas-user] FromURL() converts + to space
Bruce Steers
bsteers4 at gmail.com
Thu Oct 19 00:15:48 CEST 2023
On Wed, 18 Oct 2023, 20:31 Benoît Minisini, <
benoit.minisini at gambas-basic.org> wrote:
> Le 18/10/2023 à 19:09, Bruce Steers a écrit :
> > if i use
> >
> > Print FromURL("AB+12.txt")
> >
> > i get "AB 12.txt"
> >
> > is that by design or a bug?
> >
> > the bug has been discovered when using Drag.Paste("text/uri-list") when
> > using Drop on a control with a filename having a + in the name.
> > it seems Drag.Paste("text/uri-list") seems to use the same FromURL()
> > function.
> >
> > Respects
> > BruceS
> >
>
> Yes, it's my fault, it's buggy.
>
> '+' is a space only in the query part of the URL, not in the path part
> where it must be kept as is.
>
> Maybe FromUrl() could transform '+' in space after it has encountered a
> literal '?'.
>
> Note that "AB+12.txt" is not URL, so there is no reason to send it to
> FromURL().
>
> And there should be no problem with Url(), as '+' is always encoded into
> '%2B'.
>
> Regards,
>
> --
> Benoît Minisini.
>
I think the latest commit fixes FromURL() (thank you)
but not Drag.Paste()
Maybe line 287 of gb.gui.base/.src/main.module (UrlListToPath() Sub)
aPaths.Add(Main.URLUnquote(Mid$(sUri, 8)))
Could use the URLUnquote() optional bool DoNotDecodePlus argument
aPaths.Add(Main.URLUnquote(Mid$(sUri, 8), True))
Respects
BruceS
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231018/6f6deb62/attachment.htm>
More information about the User
mailing list