fix(desktop): 修复粘贴附件保存到错误的工作区目录#3600
Merged
esengine merged 1 commit intoJun 8, 2026
Merged
Conversation
c777f52 to
9db6228
Compare
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.
, \attachments, name))。cwd 在启动时从 \desktop-workspace\ 设置一次,当用户切换到不同项目的标签页时不会更新。
当前活动标签页的正确工作区根目录可以通过 \App.activeWorkspaceRoot()\ 获取(已被 \LoadConfig\ 等多个方法使用),但这两个方法没有使用它。
修复方案
在写入附件前,先 \os.Chdir\ 到活动标签页的 \WorkspaceRoot\,然后通过 defer 恢复原始 cwd。有优雅降级处理——如果 \�ctiveWorkspaceRoot()\ 返回 \\ 或 \.\,或者 chdir 失败,会保留原有行为。