1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-17 23:34:50 +00:00
TiddlyWiki5/core/modules/utils/dom
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
..
animations Restored animations for the reveal widget 2013-11-01 17:23:08 +00:00
animator.js Fix animation behaviour of reveal widget 2013-11-02 09:21:11 +00:00
browser.js Limited implementation of external text tiddlers in the browser 2015-08-29 16:33:04 +01:00
csscolorparser.js Provisionally make tag pill foreground colour be responsive 2014-11-06 13:35:48 +00:00
csscolorparser.js.meta Provisionally make tag pill foreground colour be responsive 2014-11-06 13:35:48 +00:00
dom.js Add the querySelectorSafe() function and replace querySelector() usage (#7380) 2023-05-06 11:54:54 +01:00
dragndrop.js Fix drag and drop from chrome-like browsers to FireFox (#7622) 2023-07-22 15:47:39 +01:00
http.js Fix encodebase64 and decodebase64 filters (#7683) 2023-10-18 16:08:56 +01:00
keyboard.js Introduce text editor toolbar (#2315) 2016-04-22 08:36:29 +01:00
modal.js Optionally allow click outside to close modals (#7072) 2022-12-03 17:26:44 +00:00
notifier.js Add alert role to notifications so they're automatically spoken by screen readers. (#6743) 2022-06-28 17:48:03 +01:00
popup.js Fixed PR to fix popup position if popup is triggered from within an offsetParent element (#7013) 2022-12-01 21:16:44 +00:00
scroller.js Add the querySelectorSafe() function and replace querySelector() usage (#7380) 2023-05-06 11:54:54 +01:00