mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2025-12-25 11:30:55 -08:00
Fix problem with not encoding body of non-base64 data URIs
This commit is contained in:
parent
3806168038
commit
96462de2f5
1 changed files with 8 additions and 3 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue