mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Fix problem with not encoding body of non-base64 data URIs
This commit is contained in:
parent
3806168038
commit
96462de2f5
@ -28,8 +28,13 @@ DataUriWidget.prototype.generate = function() {
|
||||
if(tiddler) {
|
||||
var type = tiddler.fields.type || "text/vnd.tiddlywiki",
|
||||
typeInfo = $tw.config.contentTypeInfo[type],
|
||||
isBase64 = typeInfo && typeInfo.encoding === "base64";
|
||||
uri = "data:" + type + (isBase64 ? ";base64" : "") + "," + tiddler.fields.text;
|
||||
isBase64 = typeInfo && typeInfo.encoding === "base64",
|
||||
parts = ["data:"];
|
||||
parts.push(type);
|
||||
parts.push(isBase64 ? ";base64" : "");
|
||||
parts.push(",");
|
||||
parts.push(isBase64 ? tiddler.fields.text : encodeURIComponent(tiddler.fields.text));
|
||||
uri = parts.join("");
|
||||
}
|
||||
// Set the element
|
||||
this.tag = "pre";
|
||||
@ -45,4 +50,4 @@ DataUriWidget.prototype.generate = function() {
|
||||
|
||||
exports.datauri = DataUriWidget;
|
||||
|
||||
})();
|
||||
})();
|
Loading…
Reference in New Issue
Block a user