Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Project archives silently replace existing assets when external paths collide

未关闭
#6,721 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@AksharP5 已经在做这个了。

开始于 2026年10月29日。

  • #6722 来自 @AksharP5 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
bun, node.js, typescript
领域
backend, cli

调研方向

Read packages/cli/src/utils/publishProject.ts, especially localizeExternalAssets and addExternalAsset, then run the synthetic reproduction with cloud render --dry-run --json and inspect the archive. Done means existing red and blue assets retain their contents and paths, both green references point to a separate archived file, and the archive contains four files including index.html.

由索引模型根据 Issue 内容生成。

描述

Describe the bug

Packing a project can silently replace a project asset with an unrelated external asset. The published/cloud-rendered project then displays the wrong image even though the local files are unchanged and archive preparation succeeds.

This affects projects that already contain an _ext/ directory, including source unpacked from a HyperFrames project archive, and then reference another sibling asset whose localized name collides with an existing file.

Minimal reproduction

Run from a built repository checkout with Bun and Node 22+:

#!/usr/bin/env bash
set -euo pipefail
# Run from a built repository checkout. All inputs are synthetic.
proof_dir=$(mktemp -d)
mkdir -p "$proof_dir/project/_ext/shared" "$proof_dir/shared"
for pair in 'project/_ext/shared/logo.svg red' 'project/_ext/shared/logo_2.svg blue' 'shared/logo.svg green'; do
  read -r name color <<< "$pair"
  printf '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect width="100" height="100" fill="%s"/></svg>' "$color" > "$proof_dir/$name"
done
cat > "$proof_dir/project/index.html" <<'HTML'
<html><body><div data-composition-id="logos" data-width="400" data-height="100" data-duration="1" data-no-timeline><img src="_ext/shared/logo.svg"><img src="_ext/shared/logo_2.svg"><img src="../shared/logo.svg"><img src="../shared/logo.svg"></div></body></html>
HTML
HYPERFRAMES_NO_UPDATE_CHECK=1 HYPERFRAMES_SKIP_SKILLS=1 DO_NOT_TRACK=1 node packages/cli/bin/hyperframes.mjs cloud render "$proof_dir/project" --dry-run --json
(cd packages/cli && bun --eval '
import { createPublishArchive } from "./src/utils/publishProject.ts";
import AdmZip from "adm-zip";
const zip = new AdmZip(createPublishArchive(process.argv[1]).buffer);
console.log("entries", zip.getEntries().map(entry => entry.entryName));
console.log("original red preserved", zip.readAsText("_ext/shared/logo.svg").includes("fill=\"red\""));
console.log("new green separately archived", zip.readAsText("_ext/shared/logo_3.svg").includes("fill=\"green\""));
console.log("HTML", zip.readAsText("index.html"));
' "$proof_dir/project")
printf 'Synthetic fixture retained at %s\n' "$proof_dir"
Steps to reproduce
  1. Create the synthetic project above. Its first image references an existing red logo and its third image references a different green sibling logo.
  2. Run the public cloud render --dry-run --json command. It uses the same archive staging as publish without uploading anything.
  3. Inspect the resulting ZIP through createPublishArchive, also used by publish/cloud rendering.
Expected behavior

All three distinct assets survive. The existing red and blue assets retain their paths; both green references point to a separately archived file. There should be four files including index.html.

Actual behavior

The command exits 0 and reports file_count: 3. The ZIP's _ext/shared/logo.svg contains the green asset's bytes. The first and third images both reference that key, so the original red image is silently replaced. original red preserved and new green separately archived both print false.

Environment

Main 49e0312300d6c049b19eb8435930f980621a993f, Linux arm64, Bun 1.4.4, Node v24.22.1. Reproduced with synthetic SVGs and the actual CLI dry-run. No authenticated cloud job or publish request is needed.

Additional context

localizeExternalAssets creates an empty usedArchivePaths set even though the file map already contains project files. addExternalAsset therefore treats an existing key as available and replaces it. Its existing suffix loop already handles collisions between newly localized external files; the initial staged project files need to participate too.

Searched live open/closed issues and PRs for publish overwrite, archive collision, _ext, usedArchivePaths, and archive existing, and read the related #1160/#2595/#5309/#6266 discussions. #6265's documented query/fragment omissions are a separate problem. #6687 changes OAuth endpoint selection in the same file and does not cover archive paths.

主要语言
TypeScript
星标
54.1k
派生
4.9k
平均合并
8 小时 46 分钟
30 天内合并 PR
781

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

heygen-com/hyperframes 的其他 Issue

查看 heygen-com/hyperframes 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。