unosquare / embedio

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

HtmlDirectoryListener adds slash to the end of file URLs #504

Closed rbdavison closed 2 years ago

rbdavison commented 3 years ago

Description of the bug When listing files in directories using the HtmlDirectoryListener the URLs for the files end in a slash. This causes issues with some tools such as wget which will download the file and save it as index.html instead of the name of the files.

To Reproduce Steps to reproduce the behavior:

  1. In a directory (/temp) put some files
  2. Create a server using the following code WebServer server = new WebServer(HttpListenerMode.EmbedIO, "http://*:8080"); server.WithLocalSessionManager(); server.WithModule(new EmbedIO.Files.FileModule("/", new EmbedIO.Files.FileSystemProvider(Path.GetFullPath(Path.Combine("/", "temp")), false)) { DirectoryLister = EmbedIO.Files.DirectoryLister.Html, }); server.RunAsync();
  3. Open the servers web page in a web browser
  4. Examine the URLs for the files that are listed in the directory

Expected behavior The URLs for listed files should not end with a slash.

Screenshots Chrome browser from Windows FileURLs Chrome on Android Screenshot_20210304-004122

Desktop:

Smartphone:

Additional context Pull request: https://github.com/unosquare/embedio/pull/503

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.