fix(share): harden story share and relocate import button
- Add Content-Length pre-check to story-pack and story-unpack routes to reject oversized payloads before buffering the body - Suppress internal error details in story-unpack catch (was leaking e.message to the client) - Strengthen sceneIndex validation: require non-negative integer - Guard against undefined storyState when replaying shared stories - Fix prefetch regression: remove currentBeat?.id from useEffect deps that was re-triggering all change-scene prefetches on every beat - Fix double detach: use else-if so the second replay detach guard doesn't fire redundantly after the first already detached - Align client file-size limit by format (.json 12MB, .infiplot 13MB) - Move "载入剧情" import button next to "开始" with hover tooltip Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+5
-1
@@ -155,7 +155,11 @@ export function parseStoryShareDoc(value: unknown): StoryShareDoc {
|
||||
if (typeof value.exportedAt !== "number" || !Number.isFinite(value.exportedAt)) {
|
||||
throw new Error("剧情分享文件缺少导出时间");
|
||||
}
|
||||
if (!isRecord(value.current) || typeof value.current.sceneIndex !== "number") {
|
||||
if (
|
||||
!isRecord(value.current) ||
|
||||
!Number.isInteger(value.current.sceneIndex) ||
|
||||
(value.current.sceneIndex as number) < 0
|
||||
) {
|
||||
throw new Error("剧情分享文件缺少当前位置");
|
||||
}
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user