Skip to content

Commit

Permalink
Fix suffix does not work for base64 operators (#8574)
Browse files Browse the repository at this point in the history
* Fix suffix does not work for base64 operators

* Remove console.log
  • Loading branch information
Leilei332 committed Sep 6, 2024
1 parent f0cb57f commit dcf63b7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/modules/filters/encodings.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Export our filter functions

exports.decodebase64 = function(source,operator,options) {
var results = [];
var binary = operator.suffixes && operator.suffixes.indexOf("binary") !== -1;
var urlsafe = operator.suffixes && operator.suffixes.indexOf("urlsafe") !== -1;
var binary = operator.suffixes && operator.suffixes[0].indexOf("binary") !== -1;
var urlsafe = operator.suffixes && operator.suffixes[0].indexOf("urlsafe") !== -1;
source(function(tiddler,title) {
results.push($tw.utils.base64Decode(title,binary,urlsafe));
});
Expand All @@ -28,8 +28,8 @@ exports.decodebase64 = function(source,operator,options) {

exports.encodebase64 = function(source,operator,options) {
var results = [];
var binary = operator.suffixes && operator.suffixes.indexOf("binary") !== -1;
var urlsafe = operator.suffixes && operator.suffixes.indexOf("urlsafe") !== -1;
var binary = operator.suffixes && operator.suffixes[0].indexOf("binary") !== -1;
var urlsafe = operator.suffixes && operator.suffixes[0].indexOf("urlsafe") !== -1;
source(function(tiddler,title) {
results.push($tw.utils.base64Encode(title,binary,urlsafe));
});
Expand Down

0 comments on commit dcf63b7

Please sign in to comment.