HTTPS Mirror Webserver Issue with Spaces/Character Encoding in URL path
rreinhardt opened this issue · comments
Hello!
I've found that the https mirror is rendering a 404 for files that include spaces in their name.
Example:
The following ways of linking to a file work:
dat://39389303/files/file name with spaces.mp3
dat://domain.name/file name with spaces.mp3
However this does not:
https://domain.name/file name with spaces.mp3
It returns a 404 file not found.
I'm not entirely sure where to troubleshoot this. My first inclination is to dig into server.js as opposed to server environment so I thought I'd create an issue. I'll continue to investigate locally but if it's really issue, here is a ticket for it :)
Thanks for filing. Should just need to handle percent-encoded paths at https://github.com/beakerbrowser/homebase/blob/master/lib/vhosts/dat.js#L87
Hi @pfrazee, thank you for taking the time to reply and to point me the right direction.
I applied a local fix on line 103 of dat.js that solved the issue.
path = decodeURI(path)
I don't know if this is the best spot, or the best approach, for handling percent-encoded paths but I'll see how other path checks/manipulations are done here and maybe look into a better solution. (or have it better solved by more capable hands 😺 )
Seems fine with me if you want to make a PR
Sounds good. Will do!
Fix deployed as 2.0.8
, thanks @rreinhardt