You are here: Home » Reply

Reply To: filenames with question marks are not scanned, patch to fix!

#16188

Anonymous

Ok, more light on the subject..

In io.c:io_open()
io_open is pass the location: file:///MP3s/The+Smiths/Hatful+Of+Hollow/The+Smiths+-+How+Soon+Is+Now%3f.mp3

1) Split the location into protocol and path
proto_part=file
path_part=/MP3s/The+Smiths/Hatful+Of+Hollow/The+Smiths+-+How+Soon+Is+Now%3f.mp3

2) URL decode the path
proto_part=file
path_part=/MP3s/The Smiths/Hatful Of Hollow/The Smiths – How Soon Is Now?.mp3

3) Split the path at ? for options
path_part=MP3s/The Smiths/Hatful Of Hollow/The Smiths – How Soon Is Now
option_part=.mp3

I don’t believe this to be correct

Take this URL for example

http://somesite/path+with+spaces/question%3fmark

The %3f is not decoded THEN interpreted as a option seperated. The ? must be searched for prior to URL decoding
Url decoding can then be carried out AFTER the ? has been located..

I think:
if(path_part)
io_urldecode(path_part);
needs to happen AFTER the option_part have been defined and on option_part and path_part independently

This way an encoded ? as %3f will not be incorrectly parsed as an option.

I’ll write a patch after I’ve tested this theory out!