unosquare / embedio

A tiny, cross-platform, module based web server for .NET
http://unosquare.github.io/embedio
Other
1.47k stars 176 forks source link

Account for spaces in filenames/directories within a zipfile when using ZipFileProvider #405

Closed vbhavsar-alchemysystems closed 5 years ago

vbhavsar-alchemysystems commented 5 years ago

ZipFileProvider allows us to use a zip file as an endpoint to deliver files via the webserver. However when there are spaces in the files, these files are retrieved with encodings. For example the zipped file "foo bar.jpg" is retrieved with "foo%20bar.jpg". The method in ZipFileProvider.MapUrlPath cannot find this file and returns null.

Expected behavior We should be able to retrieve a file by unencoding the Url

Additional context It seem we can simply add the following line in ZipFileProvider.MapUrlPath, after checking urlPath length (before getting the entry from the zipFile: urlPath = Uri.UnescapeDataString(urlPath);