Skip to content

🐛 Fix(gui): create the clipboard image folder before built-in clipboard uploads - #1460

Merged
Molunerfinn merged 1 commit into
Molunerfinn:devfrom
b84330808:fix-builtin-clipboard-image-folder
Nov 13, 2026
Merged

Molunerfinn merged 1 commit into
Molunerfinn:devfrom
b84330808:fix-builtin-clipboard-image-folder

Conversation

@b84330808

Copy link
Copy Markdown
Contributor

With "use built-in clipboard" turned on, uploading a screenshot from the clipboard does nothing when <config dir>/picgo-clipboard-images doesn't exist. uploadWithBuildInClipboard writes the PNG there with write-file-atomic, which doesn't create parent folders, so the write throws ENOENT, the error only goes to the log and the upload never starts.

PicGo-Core creates that folder only when its own clipboard script runs, so the folder can be missing on a fresh config dir, or after switching to a custom config path, if the built-in clipboard is the only one used there.

This is the error in #1375 (Windows; the reporter found that turning the built-in clipboard off made it work), #1364 and #1263 (macOS). The .png.<number> suffix in those logs is write-file-atomic's temp file, so they come from this code path. The toolbox fix works around it by creating the folder; this change creates it right before the write.

  • fse.ensureDir() on the folder before writing the clipboard image
  • test: a built-in clipboard upload into a fresh temp config dir (real fs) now uploads instead of returning false

pnpm vitest run src/__tests__/main/uploader-context.spec.ts fails before the change and passes after; the full pnpm test suite, tsc --noEmit and eslint on the touched files pass.

…rd uploads

With the built-in clipboard enabled, the clipboard image is written to
<config dir>/picgo-clipboard-images with write-file-atomic, which does not
create parent folders. PicGo-Core only creates that folder when its own
clipboard script runs, so on a config dir where it is missing the write
fails with ENOENT and the upload silently does nothing (Molunerfinn#1375, Molunerfinn#1364, Molunerfinn#1263).

Create the folder before writing the image.
@Molunerfinn

Copy link
Copy Markdown
Owner

Thanks! I will take a look

@Molunerfinn

Copy link
Copy Markdown
Owner

Thanks for your contribution!

@Molunerfinn
Molunerfinn merged commit 4671a6d into Molunerfinn:dev Nov 13, 2026
3 checks passed
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