Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[sam2][demo][1/x] Fix file upload#364

Merged
raedle merged 1 commit into
mainfrom
pr364
Oct 8, 2024
Merged

[sam2][demo][1/x] Fix file upload#364
raedle merged 1 commit into
mainfrom
pr364

Conversation

@raedle

@raedle raedle commented Oct 8, 2024

Copy link
Copy Markdown
Contributor

Summary:

The Strawberry GraphQL library recently disabled multipart requests by default. This resulted in a video upload request returning "Unsupported content type" instead of uploading the video, processing it, and returning the video path.

This issue was raised in #361. A forward fix is to add multipart_uploads_enabled=True to the endpoint view.

Test Plan:

Tested locally with cURL and upload succeeds

Request

curl http://localhost:7263/graphql \
  -F operations='{ "query": "mutation($file: Upload!){ uploadVideo(file: $file) { path } }", "variables": { "file": null } }' \
  -F map='{ "file": ["variables.file"] }' \
  -F [email protected]

Response

{"data": {"uploadVideo": {"path": "uploads/<HASH>.mp4"}}}

@ronghanghu

ronghanghu commented Oct 8, 2024

Copy link
Copy Markdown
Contributor

Thanks for the fix!

Should we also update the Strawberry version in setup.py to be "strawberry-graphql>=0.243.0"? (Otherwise the multipart_uploads_enabled parameter might not be available since it's newly introduced in strawberry-graphql/strawberry@37265b2, and users might get an error if they are running an older version of strawberry-graphql)

(I think we can either use a loose version of "strawberry-graphql>=0.243.0" or pin it to a strict version like "strawberry-graphql~=0.246")

Summary:

The Strawberry GraphQL library recently disabled multipart requests by default. This resulted in a video upload request returning "Unsupported content type" instead of uploading the video, processing it, and returning the video path.

This issue was raised in #361. A forward fix is to add `multipart_uploads_enabled=True` to the endpoint view.

Test Plan:

Tested locally with cURL and upload succeeds

*Request*

```
curl http://localhost:7263/graphql \
  -F operations='{ "query": "mutation($file: Upload!){ uploadVideo(file: $file) { path } }", "variables": { "file": null } }' \
  -F map='{ "file": ["variables.file"] }' \
  -F [email protected]
```

*Response*

```
{"data": {"uploadVideo": {"path": "uploads/<HASH>.mp4"}}}
```

@ronghanghu ronghanghu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, and adding a minor comment about the version in setup.py.

@raedle raedle merged commit c98aa6b into main Oct 8, 2024
mahmoudzaouali pushed a commit to mahmoudzaouali/sam2 that referenced this pull request Jul 31, 2025
[sam2][demo][1/x] Fix file upload

Summary:

The Strawberry GraphQL library recently disabled multipart requests by default. This resulted in a video upload request returning "Unsupported content type" instead of uploading the video, processing it, and returning the video path.

This issue was raised in facebookresearch#361. A forward fix is to add `multipart_uploads_enabled=True` to the endpoint view.

Test Plan:

Tested locally with cURL and upload succeeds

*Request*

```
curl http://localhost:7263/graphql \
  -F operations='{ "query": "mutation($file: Upload!){ uploadVideo(file: $file) { path } }", "variables": { "file": null } }' \
  -F map='{ "file": ["variables.file"] }' \
  -F [email protected]
```

*Response*

```
{"data": {"uploadVideo": {"path": "uploads/<HASH>.mp4"}}}
```
maximuswatkins pushed a commit to owen24819/CellSam2 that referenced this pull request May 25, 2026
[sam2][demo][1/x] Fix file upload

Summary:

The Strawberry GraphQL library recently disabled multipart requests by default. This resulted in a video upload request returning "Unsupported content type" instead of uploading the video, processing it, and returning the video path.

This issue was raised in facebookresearch#361. A forward fix is to add `multipart_uploads_enabled=True` to the endpoint view.

Test Plan:

Tested locally with cURL and upload succeeds

*Request*

```
curl http://localhost:7263/graphql \
  -F operations='{ "query": "mutation($file: Upload!){ uploadVideo(file: $file) { path } }", "variables": { "file": null } }' \
  -F map='{ "file": ["variables.file"] }' \
  -F [email protected]
```

*Response*

```
{"data": {"uploadVideo": {"path": "uploads/<HASH>.mp4"}}}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cla signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants