Skip to content

Conversation

flibbles
Copy link
Contributor

@flibbles flibbles commented Sep 19, 2025

The blob doesn't work for downloading a tiddler type that calls itself out as a base64 type. Using data urls does work.

This change makes it possible to download png and other base64 encoded tiddlers correctly.

It's for TW5-Graph, but it struck me as rather amazing that there does not appear to be any way to download an image tiddler as an actual image. Seems like something SOMEONE would have wanted to do by now.

Copy link

netlify bot commented Sep 19, 2025

Deploy Preview for tiddlywiki-previews ready!

Name Link
🔨 Latest commit 087555f
🔍 Latest deploy log https://app.netlify.com/projects/tiddlywiki-previews/deploys/68dbe706a41f52000805675e
😎 Deploy Preview https://deploy-preview-9297--tiddlywiki-previews.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

Confirmed: flibbles has already signed the Contributor License Agreement (see contributing.md)

Copy link

github-actions bot commented Sep 19, 2025

📊 Build Size Comparison: empty.html

Branch Size
Base (master) 2418.3 KB
PR 2418.6 KB

Diff: ⬆️ Increase: +0.3 KB

@flibbles
Copy link
Contributor Author

Without this, it seems to be impossible to download an image/png tiddler as an actual png tiddler unless one makes their own javascript solution that does not touch the saver-handler.

With this, you can flag an image/png tiddler as image/png;base64 and use the plaintext template, and it'll download just fine.

@flibbles
Copy link
Contributor Author

Added a comment to explain to future coders why we'd use data urls over blobs for base64 tiddlers.

I would write tests for this, but I can't think of a way to do it that wouldn't involve a big infrastructure of mocked system methods, and would be rather arbitrary anyway. Since you can only know which download style you want from seeing how they react in the browser.

@flibbles
Copy link
Contributor Author

I'm fine if this gets rejected, by the way. But then I would say that TW should include $action support for downloading images. tm-download-file should be able to download images without needing to specify that they're base64 encoded (like this PR requires).

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.

3 participants