mirror of
https://github.com/horizon-rust/horizon-site.git
synced 2026-12-03 19:12:41 +07:00
[PR #23] [MERGED] Submit form: read the picked file first, say to pick it again when it changed #25
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
horizon-rust/horizon-site#25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/horizon-rust/horizon-site/pull/23
Author: @ludovic111
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @ludovic111
Base:
main← Head:fix/mod-submit-unreadable-file📝 Commits (2)
a38ed99Submit form: read the picked file before sending, name it when it can't be readc5165e9Merge remote-tracking branch 'origin/main' into fix/mod-submit-unreadable-file📊 Changes
3 files changed (+56 additions, -6 deletions)
View changed files
📝
src/mods-submit.js(+11 -5)📝
src/mods.js(+29 -0)📝
src/mods.test.mjs(+16 -1)📄 Description
The bug
A signed-in contributor sending a mod on /mods/submit got "The service didn't answer. Try again in a minute." ten times.
Railway's http logs for the
siteservice show the reason. All ten requests (2026-10-30 13:06:31–13:09:00Z, Chrome 156 on Windows) ended with 499, "client has closed the request before the server could send a response", after 1 ms. The browser cut each request right after its headers, so no byte of the file was sent and the registry never saw it. The request's ownfetchthrew, which is the form'scatch. The last submission that worked (03:50Z) took 6.2 s and got its 200.That's how Chrome behaves when a picked file changed on disk after it was picked (
ERR_UPLOAD_FILE_CHANGED): a mod rebuilt while the form is open, a file moved, or a file locked by another program. I reproduced it in Chromium 1248 (playwright, local server):Clicking Submit again resends the same stale reference, so every retry failed in 1 ms. Five of the ten came within one second.
The fix
readPicked()(inmods.js, unit-tested) reads the file and the.minisigbefore anything is sent. The form then uploads those bytes.index::MAX_FILE) is refused before the upload.try, so a failure there showed nothing at all. It is now covered too.Checked in Chromium on the built page against a stub service:
npm test: 57 pass, 0 fail.node build.mjsbuilds.The registry's side (drain the body before refusing, JSON 413, a clear "GitHub is slow" error) is a separate PR in horizon-rust/horizon.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.