Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to serve files with embedded new line #144

Open
Dialga opened this issue Dec 23, 2023 · 2 comments
Open

Unable to serve files with embedded new line #144

Dialga opened this issue Dec 23, 2023 · 2 comments
Assignees
Labels
trying-to-reproduce-the-issue Not able to reproduce the issue yet

Comments

@Dialga
Copy link

Dialga commented Dec 23, 2023

A file name with embedded new lines will return as "File not found:" on the web server.
Miniserve was also not able to serve the file, python http.server, php -S and darkhttpd were able to.

@xyproto
Copy link
Owner

xyproto commented Dec 23, 2023

Thanks for reporting.

If a file contains an embedded newline, like index.md containing some text, then a blank line and then some text, then serving the file works.

Do you have an example of serving a file where the filename contains a newline? Normally, filenames does not and should not contain newlines.

Please help me understand the isssue, with steps to reproduce the issue, if you could. Thanks.

@xyproto xyproto added trying-to-reproduce-the-issue Not able to reproduce the issue yet waiting-for-a-reply Waiting for a reply or clarification from the submitter of the issue labels Dec 23, 2023
@Dialga
Copy link
Author

Dialga commented Dec 23, 2023

Sure thing, transcript as follows:

$ echo hi > 'new'$'\n''file'
$ mkdir 'hi'$'\n''world'$'\n'
$ echo hi > 'hi'$'\n''world'$'\n/file'$'\n'name''
$ algernon . 127.0.0.1:8080 -p

It appears the directory listing does not encode the urls.
image
If I manually url encode the link, I can view the file.
image
Same with visiting the directory.

@xyproto xyproto removed the waiting-for-a-reply Waiting for a reply or clarification from the submitter of the issue label Dec 23, 2023
@xyproto xyproto self-assigned this Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
trying-to-reproduce-the-issue Not able to reproduce the issue yet
Projects
None yet
Development

No branches or pull requests

2 participants