Skip to content

fix(server): allow dot-directory paths when serving project files#763

Draft
YuchenWell wants to merge 1 commit into
cocos:mainfrom
YuchenWell:fix/sendfile-allow-dotfiles
Draft

fix(server): allow dot-directory paths when serving project files#763
YuchenWell wants to merge 1 commit into
cocos:mainfrom
YuchenWell:fix/sendfile-allow-dotfiles

Conversation

@YuchenWell

Copy link
Copy Markdown

express/send 默认 dotfiles: 'ignore',路径中任何以 "." 开头的目录段都会被判
404,再经兜底错误中间件变成 500。当项目位于点目录下时(如 PinK 自动化的
.agent/workspaces、用户的 ~/.projects/xxx),场景编辑器请求
/scripting/engine/effect-settings 拿到 500 错误页,引擎将其当二进制解析,在
loadLayoutGraphData 抛 RangeError,初始化失败,场景视口黑屏。

  • 将 sendFileAllowingDotfiles 收敛到 server/utils 作为 server 层通用 helper,
    preview / scene / builder 统一从此导入
  • 修复遗漏的 5 处裸 res.sendFile:
    • preview/scripting-routes:/scripting/engine/effect-settings(黑屏直接原因)、
      /static/web、/scripting/systemjs extras
    • scene/scene.scripting.middleware:/scripting/effect-settings
    • builder/build.middleware:/build/:platform/:name/*
  • 新增 effect-settings 在点目录项目路径下的回归测试

@YuchenWell
YuchenWell marked this pull request as draft July 17, 2026 02:18
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