steffest / BassoonTracker

Webbased old-school Amiga music tracker in plain old javascript - Plays and edits Amiga Mod files and FastTracker XM files
http://www.stef.be/bassoontracker/
MIT License
990 stars 61 forks source link

Url parameters: files with special characters like # & - broken? #46

Closed divzilla closed 5 years ago

divzilla commented 5 years ago

How to correctly encode the filename in the URL?

normal filename works: https://www.stef.be/bassoontracker/?file=https://modland.ziphoid.com/pub/modules/Protracker/Dizy/conspiracy2.mod

with special chars like # & it doesn't https://www.stef.be/bassoontracker/?file=https://modland.ziphoid.com/pub/modules/Protracker/Dizy/chiptune#2.mod

Am I wrong or your code? https://mod.schugo.de -> Bassoon Tracker

from there you can load modland files...

steffest commented 5 years ago

Those special chars like # , & and ? are ... well... special in urls. So if they point to a file containing those you have to urlencode them. e.g. https://modland.ziphoid.com/pub/modules/Protracker/Dizy/chiptune#2.mod gives a 404 not found but https://modland.ziphoid.com/pub/modules/Protracker/Dizy/chiptune%232.mod works. (# becomes %23)

If you then take that encoded URL and you put that as parameter in another URL, you have to DOUBLE url encode it. %23 then becomes %2523

So the working url to get that file in BassoonTracker is

https://www.stef.be/bassoontracker/?file=https://modland.ziphoid.com/pub/modules/Protracker/Dizy/chiptune%25232.mod

My advice: avoid using special chars like #?&% in file names if you want to use them on the web, that saves a lot of trouble.

P.S. Very cool tool! Didn't know that one yet.

divzilla commented 5 years ago

thx! will try. filenames are from modland, so not under my control ;) ciao