ppeccin / WebMSX

WebMSX - Online MSX Emulator
https://webmsx.org
396 stars 70 forks source link

URL special characters in DISKA_FILES_URL #10

Closed digitalica closed 6 years ago

digitalica commented 7 years ago

I'm trying to load

http://webmsx.org/?MACHINE=MSX1E&DISKA_FILES_URL=http://www.msxcomputermagazine.nl/archief/listings/mcmd01.di1/blue%26pin&BASIC_RUN=blue%26pin

Note the url escaped & in the filename 'blue&pin'.

the basic_run works, but the file doesn't. The request the emulator makes to my server is:

54.147.43.152 - - [01/Feb/2017:10:27:25 +0100] "GET /listings/mcmd01.di1/blue HTTP/1.1" 404 508 "-" "-"

note filename is missing '&pin'. And the resulting 404 error.

looks like the emulator doesn't escape the filename. I think it should, although i could probably make it work by escaping twice ;-)

I would prefer not to change the weird (but historically correct) filenames of course.

digitalica commented 7 years ago

Ive been checking your code, found the console log:

Reading file from: http://www.msxcomputermagazine.nl/archief/listings/mcmd01.di1/blue&pin

(wont work, without escaping the &)

and realized as I'm giving you a URL, maybe i should escape twice. But that doesnt work eigther:

http://webmsx.org/?MACHINE=MSX1E&DISKA_FILES_URL=http://www.msxcomputermagazine.nl/archief/listings/mcmd01.di1/blue%2526pin&BASIC_RUN=blue%26pin

console log then shows correctly: Reading file from: http://www.msxcomputermagazine.nl/archief/listings/mcmd01.di1/blue%26pin

looks like the the files command shows me 'BLUE%2~1' then ;-) That will run though.

double escaping the BASIC_RUN too didn't work. It tried to run "blue%26pin" as expected.

so i think solutions could be: 1) unescaping the name you use to show in files command before using it. (so i can give double escaped url) 2) escaping the name part of the url before using it. (not the full url, as the : and / should not be affected of course...)

i'm not sure what would be the cleanest approach....

hmmm....

ppeccin commented 7 years ago

I used your link, and when I run a "FILES" command, I see a file "BLUE%2~1"

So that is the name you should try to use in the BASIC_RUN command.

I realize that this is probably an issue in the way the automatic image builder is treating the "&" character in the original filename. It is seeing the "&" as an invalid character and is renaming the file to something possible.

This probably can be improved, but for now, use the renamed file name, OR if you really want to keep the original file name, for that specific case you will have to create a disk image (.DSK) with you file to preserve the name, then load the image. It will work.

On Wed, Feb 1, 2017 at 8:26 AM, Robbert Wethmar notifications@github.com wrote:

Ive been checking your code, found the console log:

Reading file from: http://www.msxcomputermagazine.nl/ archief/listings/mcmd01.di1/blue&pin

(wont work, without escaping the &)

and realized as I'm giving you a URL, maybe i should escape twice. But that doesnt work eigther:

http://webmsx.org/?MACHINE=MSX1E&DISKA_FILES_URL=http:// www.msxcomputermagazine.nl/archief/listings/mcmd01.di1/ blue%2526pin&BASIC_RUN=blue%26pin

console log then shows correctly: Reading file from: http://www.msxcomputermagazine.nl/ archief/listings/mcmd01.di1/blue%26pin

looks like the the files command shows me 'BLUE%2~1' then ;-)

hmmm....

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ppeccin/WebMSX/issues/10#issuecomment-276622793, or mute the thread https://github.com/notifications/unsubscribe-auth/AArloBNOtd154sD6eJEuywJuvSTJRHaOks5rYF3BgaJpZM4LzpoP .

digitalica commented 7 years ago

i tested wrapping problematic files in a zip. That works. So I think wel´ll just create zips for every disk just without the autoexec. That way, naming issues will be solved and we can also run a specific program, not the autoexec.

thanks for your help