Skip to content

fix: write downloaded images atomically#149

Open
rokuosanai wants to merge 3 commits into
rokuosan:mainfrom
rokuosanai:fix/harden-asset-generation
Open

fix: write downloaded images atomically#149
rokuosanai wants to merge 3 commits into
rokuosan:mainfrom
rokuosanai:fix/harden-asset-generation

Conversation

@rokuosanai

@rokuosanai rokuosanai commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • write each downloaded image to a temporary file
  • rename it into the final output path only after copying and closing succeed
  • remove the temporary file when the download stream fails

Why

A failed or interrupted image download previously left a partial file at the final asset path. That could make a generated site reference a corrupt image.

Tests

  • TMPDIR="$PWD/.tmp/go-build" go test ./pkg/core
  • TMPDIR="$PWD/.tmp/go-build" go vet ./pkg/core

@rokuosanai
rokuosanai force-pushed the fix/harden-asset-generation branch from 0ba1862 to e069a24 Compare July 24, 2026 10:48
@rokuosanai
rokuosanai force-pushed the fix/harden-asset-generation branch from e069a24 to ba3f2bc Compare July 24, 2026 10:49
@rokuosanai rokuosanai changed the title fix: harden asset generation fix: write downloaded images atomically Jul 24, 2026
@rokuosan

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba3f2bcef4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkg/core/filesystem_articles.go Outdated
@rokuosan

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9294241e0c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkg/core/filesystem_articles.go Outdated
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.

2 participants