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

HTML file upload error #210

Open
spasius opened this issue Mar 24, 2019 · 2 comments
Open

HTML file upload error #210

spasius opened this issue Mar 24, 2019 · 2 comments
Labels

Comments

@spasius
Copy link

spasius commented Mar 24, 2019

Error then trying to upload html file (source from examples):
{"description":"failed to parse a requested field","cause":{"description":"expected a file but got a field, or vice versa","cause":null}}

@tomaka tomaka added the bug label Jun 8, 2019
@NGgmnBQGwR
Copy link

I've encountered the same issue. Posting more information, in case it's needed.

Server returns 400 with error:

{"description":"failed to parse a requested field","cause":{"description":"expected a file but got a field, or vice versa","cause":null}}

if you upload any text file.
But if you rename the file to something else, then it can be uploaded successfully.

Steps to reproduce:

  1. Start example:
    cargo run --example simple-form

  2. Create text file:
    echo "Hello, world" > test.txt

  3. Open http://localhost:8000/ in browser and try to upload "text.txt". It will fail with 400.

  4. Rename this file:
    mv test.txt test.txt1

  5. Try to upload "text.txt1". It will succeed.

But I'm not experienced enough to to say whether it's a problem with example code or with rouille itself.

@PixelCoda
Copy link

PixelCoda commented Nov 8, 2021

I can verify this bug still exists on rouille v3.4.0 and it also applies to .HTML files. It appears to be a conflict between the BufferedFile struct type and plain text uploads.

Update: It works if you use a String instead of BufferedFile, but the sacrifice is compatibility for .png and other non-text file types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants