From dad6e1ca2e23b90f43dac85d6442a43b476f69c9 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 22 Nov 2017 12:02:54 -0500 Subject: [PATCH] =?UTF-8?q?Removed=20dependency=20on=20String.js=20in=20ac?= =?UTF-8?q?cordance=20with=20https://nodesecuri=E2=80=A6=20(#387)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Removed dependency on String.js in accordance with https://nodesecurity.io/advisories/536 * only strip img tags --- library.js | 4 ++-- package.json | 2 +- yarn.lock | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 yarn.lock diff --git a/library.js b/library.js index 4455671..bd4bffd 100644 --- a/library.js +++ b/library.js @@ -1,6 +1,6 @@ 'use strict'; -var S = require('string'); +var striptags = require('striptags'); var meta = module.parent.require('./meta'); var user = module.parent.require('./user'); @@ -29,7 +29,7 @@ library.addAdminNavigation = function(header, callback) { library.getTeasers = function(data, callback) { data.teasers.forEach(function(teaser) { if (teaser && teaser.content) { - teaser.content = S(teaser.content).stripTags('img').s; + teaser.content = striptags(teaser.content, ['img']); } }); callback(null, data); diff --git a/package.json b/package.json index 64e27fa..0419cad 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,6 @@ "url": "https://github.com/psychobunny/nodebb-theme-persona/issues" }, "dependencies": { - "string": "^3.3.3" + "striptags": "^3.1.0" } } diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..6ff84b8 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,7 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +striptags@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/striptags/-/striptags-3.1.0.tgz#763e534338d9cf542f004a4b1eb099e32d295e44"