feat(media): add validated upload adapter - #111
Open
xyh202131 wants to merge 2 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| async function readResponseBody(response: Response): Promise<unknown> { | ||
| try { | ||
| return await response.json() | ||
| } catch { |
Contributor
There was a problem hiding this comment.
Result
Implemented the requested fix locally, but could not push it to xyh202131:feat/media-upload from this runner.
Changed:
- Re-threw
AbortErrorfromresponse.json()so late upload cancellations stay distinguishable from upload failures. - Added a regression test for aborts thrown while reading the response body.
Verified:
npm test -- --run src/entities/media/api.test.tspassed: 1 file, 13 tests.npm run lintpassed.npm run typecheckpassed.
Not completed:
- Push failed for
https://github.com/xyh202131/Windup.gitwith GitHub authentication rejection, so local commitd16a6fdis not on the PR branch. - The pre-created FennoAI reply comment
3728817988became inaccessible via the GitHub API after the initial progress update, so this visible parent thread was updated instead.
Contributor
There was a problem hiding this comment.
Result
现在看 PR 分支已经包含修复提交了:633d96f (fix(media): preserve late upload cancellation)。
它修的是我前面指出的问题:response.json() 在读取响应体阶段如果抛出 AbortError,现在会原样重新抛出,不再被包装成 UploadRequestError。同时补了对应的回归测试。
验证通过:
npm test -- --run src/entities/media/api.test.ts:1 个文件、13 个测试通过npm run lint:通过npm run typecheck:通过
This was referenced Aug 4, 2026
This was referenced Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /media/uploadMediaReferenceVITE_API_BASE_URLis missing instead of posting to the visitor's localhostScope
Frontend only. No page, WorkflowRun, Controller, backend, object-storage configuration, database, log or build artifact is included.
Verification
format:checkremains blocked by 41 pre-existing files onmain; this PR does not mix those unrelated rewrites into the upload featureCloses #109