fix: encode URLs

This commit is contained in:
Tobi Schäfer 2015-08-10 16:01:18 +02:00
parent 04643c1f6a
commit 5b7a409dd1
3 changed files with 6 additions and 6 deletions

View file

@ -313,7 +313,7 @@ File.prototype.update = function(data) {
*
*/
File.prototype.url_macro = function() {
return res.write(this.url || this.getUrl());
return res.write(encodeURI(this.url || this.getUrl()));
}
/**

View file

@ -347,7 +347,7 @@ Image.prototype.contentLength_macro = function() {
*
*/
Image.prototype.url_macro = function() {
return res.write(this.getUrl());
return res.write(encodeURI(this.getUrl()));
}
/**
@ -369,7 +369,7 @@ Image.prototype.thumbnail_macro = function(param) {
if (!this.thumbnailName) {
return this.render_macro(param);
}
param.src = this.getUrl(this.getThumbnailFile().getName());
param.src = encodeURI(this.getUrl(this.getThumbnailFile().getName()));
param.title || (param.title = encode(this.description));
param.alt = encode(param.alt || param.title);
var width = param.width || this.thumbnailWidth;
@ -391,7 +391,7 @@ Image.prototype.thumbnail_macro = function(param) {
* @param {Object} param
*/
Image.prototype.render_macro = function(param) {
param.src = this.getUrl();
param.src = encodeURI(this.getUrl());
param.title || (param.title = encode(this.description));
param.alt = encode(param.alt || param.title);
var style = [];

View file

@ -560,7 +560,7 @@ Site.prototype.renderPage = function (parts) {
property: 'og:image',
name: 'twitter:image',
itemprop: 'image',
content: url
content: encodeURI(url)
});
}).join('\n');
}
@ -568,7 +568,7 @@ Site.prototype.renderPage = function (parts) {
res.data.videos = parts.videos.map(function (url) {
return html.tagAsString('meta', {
property: 'og:video',
content: url
content: encodeURI(url)
});
}).join('\n');
}