Skip to content

Conversation

@WoLeo-Z
Copy link

@WoLeo-Z WoLeo-Z commented Nov 17, 2025

OpenListTeam/OpenList#1668

Description / 描述

  • Simply remove the file.size > chunkSize check in the Frontend.

Motivation and Context / 背景

Relates to #249

When uploading files (size <= ChunkSize), server side uses upBig logic (for chunked upload) to request for the upload url, therefore the PUT request needs a header Content-Range.

But in frontend uploadSingle don't specify this header. Causing Upload failed with status 400.

{"error":{"code":"invalidRequest","message":"The Content-Range header is missing or malformed."}}

How Has This Been Tested? / 测试

0 < smallFileLimit (e.g. 4mb) < default ChunkSize (e.g. 5mb)

So there are 3 situations:

  • 3.5mb: Client receives ChunkSize = 0 and uses uploadSingle (1 PUT request)
  • 4.5mb: Client receives ChunkSize > 0 and uses uploadChunk but ChunkCount = 1 (1 PUT request)
  • 5.5mb: Client receives ChunkSize > 0 and uses uploadChunk but ChunkCount > 1 (multiple PUT requests)
fallocate -l 3.5M 3.5M.bin
fallocate -l 4.5M 4.5M.bin
fallocate -l 5.5M 5.5M.bin

Checklist / 检查清单

  • I have read the CONTRIBUTING document.
    我已阅读 CONTRIBUTING 文档。
  • I have formatted my code with go fmt or prettier.
    我已使用 go fmtprettier 格式化提交的代码。
  • I have added appropriate labels to this PR (or mentioned needed labels in the description if lacking permissions).
    我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
  • I have requested review from relevant code authors using the "Request review" feature when applicable.
    我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
  • I have updated the repository accordingly (If it’s needed).
    我已相应更新了相关仓库(若适用)。

@WoLeo-Z
Copy link
Author

WoLeo-Z commented Nov 18, 2025

Removing the file.size > chunkSize check may causing other direct upload functions broken. Review before merging.

(IMO if the file don't need chunked upload, chunkSize should be set 0.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant