1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-29 12:59:56 +00:00
TiddlyWiki5/core/modules
Robin Munn 326ae61929
Fix encodebase64 and decodebase64 filters (#7683)
* Fix encodebase64 and decodebase64 filters

The documentation for encodebase64 says that the input is treated as
binary data, but in fact the input is being treated as text data, with
an extra UTF-8 encoding step being performed first.

Likewise, the decodebase64 documentation says that it outputs binary
data, but in fact it will do a UTF-8 decoding step before producing
output, which will in fact garble binary data.

This commit changes the behavior of encodebase64 and decodebase64 to
match what the documentation says they do. It also adds an optional
`text` suffix to both filters to keep the current behavior.

Finally, an optional `urlsafe` suffix is added to both filters to allow
them to use the "URL-safe" variant of base64 (using `-` instead of `+`
and `_` instead of `/`).

* Try to fix failing test

Turns out a little more than this is going to be needed.

* Fix binary base64 encoding, including unit tests

* Update base64 filter documentation

* Can't use replaceAll, too new

Have to use String.replace with a global regex instead

* Replace uses of window.btoa() in rest of code

Since window.btoa() is not available under Node.js, we'll replace all
uses of it with the $tw.utils.base64encode() function that now works
correctly for binary data.

* Add link to UTF-8 glossary definition at MDN
2023-10-18 16:08:56 +01:00
..
commands Add explodePlugins=yes option to savewikifolder command (#7490) 2023-06-29 15:40:35 +01:00
editor Fix typo in 7d8766d2b9 2023-09-13 18:06:30 +01:00
filterrunprefixes Add a :then filter run prefix (#7392) 2023-06-24 18:07:34 +01:00
filters Fix encodebase64 and decodebase64 filters (#7683) 2023-10-18 16:08:56 +01:00
indexers FieldIndexer performance: use isShadowTiddler instead of allTitles (#7299) 2023-02-27 17:32:20 +00:00
info style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
macros allow unusedtitle macro to use the prefix parameter and fix wiki.generateNewTitle() (#5361) 2021-05-02 19:26:50 +01:00
parsers Conditional Shortcut Syntax (#7710) 2023-10-14 09:41:21 +01:00
savers Fix encodebase64 and decodebase64 filters (#7683) 2023-10-18 16:08:56 +01:00
server Feat: decode url-encoded user name in authenticate request header to allow CJK username in header (#7471) 2023-05-22 12:25:51 +01:00
startup Fix drag and drop from chrome-like browsers to FireFox (#7622) 2023-07-22 15:47:39 +01:00
storyviews Revert "Feat: destroy() method for widgets to do custom cleanup (#6699)" 2023-05-18 17:27:05 +01:00
upgraders Introduce JSON parse utility function with error handling (#6401) 2022-02-21 15:29:25 +00:00
utils Fix encodebase64 and decodebase64 filters (#7683) 2023-10-18 16:08:56 +01:00
widgets Extend ImageWidget to generate the src based on the encoding format of the image entries (#7783) 2023-10-17 09:47:46 +01:00
commander.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
config.js Add dollar sign to HTML entities (#7323) 2023-03-03 21:34:30 +00:00
deserializers.js Introduce JSON parse utility function with error handling (#6401) 2022-02-21 15:29:25 +00:00
filters.js Refactor dependency on widget.getVariableInfo 2023-06-11 09:46:05 +01:00
keyboard.js Allow global keyboard shortcuts to override all other shortcuts by providing a special field (#6735) 2022-10-07 17:31:04 +01:00
language.js Make lazy loading message be translateable 2015-09-08 10:41:27 +01:00
pluginswitcher.js Introduce JSON parse utility function with error handling (#6401) 2022-02-21 15:29:25 +00:00
saver-handler.js Fix faulty external-js single-file wiki (#5570) 2021-07-06 15:02:21 +01:00
story.js Fix issues with creation and modification dates 2015-09-11 13:34:01 +01:00
syncer.js Lazy loading a tiddler should trigger a sync 2023-01-03 14:28:48 +00:00
tiddler.js Radio widget should use default if field/index is missing 2022-01-09 17:17:12 +00:00
wiki-bulkops.js Fix renaming a tiddler can result in duplicate tags 2022-01-14 16:57:30 +00:00
wiki.js Allow attribute substitution to handle variables containing non-word characters (#7606) 2023-07-14 21:42:31 +01:00