Skip to content

Commit

Permalink
[core] make __nonHtmlContentData param non mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
nleush committed Sep 28, 2015
1 parent bff5673 commit 40af52e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions lib/plugins/system/htmlparser/htmlparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {

provides: [
'self',
'nonHtmlContentData'
'__nonHtmlContentData'
],

getData: function(url, options, cb) {
Expand Down Expand Up @@ -48,7 +48,7 @@ module.exports = {

if('content-type' in resp.headers && !/text\/html|application\/xhtml\+xml/gi.test(resp.headers['content-type'])){
return cb(null, {
nonHtmlContentData: {
__nonHtmlContentData: {
type: resp.headers['content-type'],
content_length: resp.headers['content-length']
}
Expand All @@ -73,9 +73,9 @@ module.exports = {
});
},

getLink: function(url, nonHtmlContentData) {
var nonHtmlContentType = nonHtmlContentData.type;
var nonHtmlContentLength = nonHtmlContentData.content_length;
getLink: function(url, __nonHtmlContentData) {
var nonHtmlContentType = __nonHtmlContentData.type;
var nonHtmlContentLength = __nonHtmlContentData.content_length;

// HEADS UP: do not ever remove the below check for 'javascript' or 'flash' in content type
// if left allowed, it'll make apps vulnerable for XSS attacks as such files will be rendered as regular embeds
Expand Down
4 changes: 2 additions & 2 deletions plugins/links/google-docs-viewer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = {

getLink: function(url, nonHtmlContentData) {
getLink: function(url, __nonHtmlContentData) {

if (/application\/pdf|text\/rtf/.test(nonHtmlContentData.type)) {
if (/application\/pdf|text\/rtf/.test(__nonHtmlContentData.type)) {
return {
href: "https://docs.google.com/viewer?embedded=true&url=" + encodeURIComponent(url),
type: CONFIG.T.text_html,
Expand Down
6 changes: 3 additions & 3 deletions plugins/links/ms-doc-viewer.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = {

getLink: function(url, nonHtmlContentData) {
getLink: function(url, __nonHtmlContentData) {

if (/application\/vnd\.openxmlformats\-officedocument|ms\-powerpoint|msword|ms\-excel|ms\-office/.test(nonHtmlContentData.type)) {
if (/application\/vnd\.openxmlformats\-officedocument|ms\-powerpoint|msword|ms\-excel|ms\-office/.test(__nonHtmlContentData.type)) {
return {
href: "https://view.officeapps.live.com/op/embed.aspx?src=" + encodeURIComponent(url),
type: CONFIG.T.text_html,
rel: [CONFIG.R.reader, CONFIG.R.ssl, CONFIG.R.HTML5],
"aspect-ratio": /presentation|ms\-powerpoint|ms\-excel|ms\-office/.test(nonHtmlContentData.type) ? 4/3 : 1 / Math.sqrt(2)
"aspect-ratio": /presentation|ms\-powerpoint|ms\-excel|ms\-office/.test(__nonHtmlContentData.type) ? 4/3 : 1 / Math.sqrt(2)
}
}
}
Expand Down

0 comments on commit 40af52e

Please sign in to comment.