Skip to content

fix(api): refresh image export cache when larger file is available#959

Merged
xunchahaha merged 1 commit into
hicccc77:devfrom
DestinyleSnowy:fix-refresh-image-export-cache
May 26, 2026
Merged

fix(api): refresh image export cache when larger file is available#959
xunchahaha merged 1 commit into
hicccc77:devfrom
DestinyleSnowy:fix-refresh-image-export-cache

Conversation

@DestinyleSnowy
Copy link
Copy Markdown
Contributor

Fixes #949

What changed

Update HTTP API image export cache logic so a later larger image can overwrite an existing smaller cached image.

Why

Previously, if the file already existed, WeFlow skipped writing it, so an exported thumbnail could keep blocking the later high-resolution image.

Testing

  • Ran git diff --check

@hicccc77 hicccc77 changed the base branch from main to dev May 14, 2026 15:07
@hicccc77 hicccc77 requested a review from xunchahaha May 14, 2026 15:07
@xunchahaha
Copy link
Copy Markdown
Collaborator

在 electron/services/httpService.ts:1546 这一行:
this.writeFileIfLarger(fullPath, imageBuffer)

这里使用了 imageBuffer,但在这个代码分支中,我们只有 imagePath 变量(原代码是 fs.copyFileSync(imagePath, fullPath))。这会导致运行时 ReferenceError。

@DestinyleSnowy
Copy link
Copy Markdown
Contributor Author

@xunchahaha 如图,可以发现展开代码后,此处调用 writeFileIfLarger 之前已经定义了 imageBuffer:
const imageBuffer = fs.readFileSync(imagePath)

所以这里不会出现 ReferenceError。应该是 GitHub 折叠 diff 时只显示了调用行的问题。

image image

@xunchahaha xunchahaha merged commit c4ef716 into hicccc77:dev May 26, 2026
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.

[Bug]: http api触发图片导出以后不再更新

2 participants