mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-05-02 21:46:53 +00:00
AWS Plugin: Add aws-encodeuricomponent filter that also encodes single quotes
Because AWS S3 doesn't allow single quotes in filenames
This commit is contained in:
27
plugins/tiddlywiki/aws/modules/encodings.js
Normal file
27
plugins/tiddlywiki/aws/modules/encodings.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/aws/encodings.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operator for applying encodeuricomponent() to each item, with the addition of converting single quotes to %27, as required by AWS
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter functions
|
||||
*/
|
||||
|
||||
exports["aws-encodeuricomponent"] = function(source,operator,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
results.push(encodeURIComponent(title).replace(/'/g,"%27"));
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user