swagger-api / swagger-api/swagger-ui

Submitting modified file will cause "Failed to fetch" error

Open
#7,459 2 comments 0 reactions 0 assignees View on GitHub

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:

  1. Create a text file by:
$ echo foo > /tmp/sample.txt
  1. Go to https://petstore.swagger.io/#/pet/uploadFile
  2. Fill in petId field with a random number, e.g. 123.
  3. Select the file created in step 1 for the file field, i.e. /tmp/sample.txt.
  4. Modify the file content by:
$ echo bar > /tmp/sample.txt
  1. Click "Execute" button.
Expected behavior

The API should be called and the file should be uploaded.

Screenshots

image

Additional context or thoughts

Without doing step 5 (modifying the file content), the API call will be executed successfully.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.