swagger-api / swagger-api/swagger-ui
Submitting modified file will cause "Failed to fetch" error
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A (please complete the following information)
- OS: macOS
- Browser: Chrome
- Version: 92.0.4515.107
- Method of installation: from official website
- Swagger-UI version: 3.20.7
- Swagger/OpenAPI version: 3.0.3
Describe the bug you're encountering
With an uploading file selected in the file selector, modifying the file and then submitting it will cause a "Failed to fetch" error.
To reproduce...
This can be reproduced on https://petstore.swagger.io/#/pet/uploadFile.
Steps to reproduce the behavior:
- Create a text file by:
$ echo foo > /tmp/sample.txt
- Go to https://petstore.swagger.io/#/pet/uploadFile
- Fill in
petIdfield with a random number, e.g.123. - Select the file created in step 1 for the
filefield, i.e./tmp/sample.txt. - Modify the file content by:
$ echo bar > /tmp/sample.txt
- Click "Execute" button.
Expected behavior
The API should be called and the file should be uploaded.
Screenshots

Additional context or thoughts
Without doing step 5 (modifying the file content), the API call will be executed successfully.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue at the petstore.swagger.io pet/uploadFile endpoint using the listed steps, including modifying the selected file before submitting. Trace the Swagger UI file-upload submission path and verify that the API is called and the modified file uploads successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100