1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-18 02:09:43 +00:00
TiddlyWiki5/editions/test/tiddlers/tests
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
..
data Fix refreshing of transcluded functions (#7698) 2023-10-14 09:44:18 +01:00
modules/utils CSV parser improvements (#7042) 2022-11-20 17:51:01 +00:00
test-action-widgets.js action-setfield shouldn't write to the current tiddler if the $tiddler attribute is present but has evaluated to a missing attribute 2022-04-16 18:02:27 +01:00
test-backlinks.js Add backlinks indexer (#4421) 2020-03-26 13:15:02 +00:00
test-checkbox-widget.js Checkbox widget should not affect date fields (#7448) 2023-05-11 18:28:44 +01:00
test-compare-filter.js Add new compare filter operator 2020-04-13 10:03:01 +01:00
test-deserialize-operator.js Adds a deserialize filter operator (#7511) 2023-06-03 14:33:10 +01:00
test-deserializers.js Add support for JSON-formatted tiddler store, and make it the default (#5708) 2021-07-14 09:15:30 +01:00
test-filters.js Ensure shadow tiddler listings are always sorted 2023-07-13 19:27:50 +01:00
test-html-parser.js Adds Text substitution support in widget attributes and new operator (#7526) 2023-06-24 14:57:15 +01:00
test-json-filters.js Introduce jsonset operator (#7742) 2023-10-14 09:43:23 +01:00
test-linked-list.js Linked-List refactor (#6056) 2022-11-27 17:48:08 +00:00
test-parsetextreference.js Parameterised transclusions (#6666) 2023-04-19 11:55:25 +01:00
test-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
test-prefixes-filter.js Add a :then filter run prefix (#7392) 2023-06-24 18:07:34 +01:00
test-tags.js Fix for tag ordering issue #6382 (#6383) 2022-02-21 15:34:05 +00:00
test-tiddler.js Add isEqual() method to tiddlers 2014-06-23 08:09:59 +01:00
test-utils.js Fix encodebase64 and decodebase64 filters (#7683) 2023-10-18 16:08:56 +01:00
test-widget.js Fix list widget bug with counter-last when appending items (#7712) 2023-09-24 20:19:50 +01:00
test-wikitext-parser.js Parameterised transclusions (#6666) 2023-04-19 11:55:25 +01:00
test-wikitext-tabs-macro.js Parameterised transclusions (#6666) 2023-04-19 11:55:25 +01:00
test-wikitext.js Switch off CamelCase linking by default (#7513) 2023-06-08 21:45:14 +01:00