From c1883f52821fd47c4a856bc36121d0df95486a48 Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 4 Feb 2019 14:25:21 -0500 Subject: [PATCH 1/3] #138 - escape html entities in BIO text --- src/components/user_settings/user_settings.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index 9bd8aa0077..7a2400f26c 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -6,7 +6,7 @@ const UserSettings = { data () { return { newName: this.$store.state.users.currentUser.name, - newBio: this.$store.state.users.currentUser.description, + newBio: this.parseEntities(this.$store.state.users.currentUser.description), newLocked: this.$store.state.users.currentUser.locked, newNoRichText: this.$store.state.users.currentUser.no_rich_text, newDefaultScope: this.$store.state.users.currentUser.default_scope, @@ -287,6 +287,14 @@ const UserSettings = { logout () { this.$store.dispatch('logout') this.$router.replace('/') + }, + parseEntities (text) { + const parser = new DOMParser + const dom = parser.parseFromString( + '' + text, + 'text/html') + const decodedText = dom.body.textContent + return decodedText } } } From e1f9298ef2c9d6166e5bf03ff4700688ebdc2eec Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 4 Feb 2019 15:03:01 -0500 Subject: [PATCH 2/3] #138 - unescape user bio --- src/components/user_settings/user_settings.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index 7a2400f26c..a9d0553263 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -1,3 +1,5 @@ +import { unescape } from 'lodash'; + import TabSwitcher from '../tab_switcher/tab_switcher.js' import StyleSwitcher from '../style_switcher/style_switcher.vue' import fileSizeFormatService from '../../services/file_size_format/file_size_format.js' @@ -6,7 +8,7 @@ const UserSettings = { data () { return { newName: this.$store.state.users.currentUser.name, - newBio: this.parseEntities(this.$store.state.users.currentUser.description), + newBio: unescape(this.$store.state.users.currentUser.description), newLocked: this.$store.state.users.currentUser.locked, newNoRichText: this.$store.state.users.currentUser.no_rich_text, newDefaultScope: this.$store.state.users.currentUser.default_scope, @@ -287,14 +289,6 @@ const UserSettings = { logout () { this.$store.dispatch('logout') this.$router.replace('/') - }, - parseEntities (text) { - const parser = new DOMParser - const dom = parser.parseFromString( - '' + text, - 'text/html') - const decodedText = dom.body.textContent - return decodedText } } } From 94fdc2d583b7c7c3aa2e92375cd0370fedc6bbda Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 4 Feb 2019 15:06:38 -0500 Subject: [PATCH 3/3] #138 - fix lint error --- src/components/user_settings/user_settings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index a9d0553263..df757dfba9 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -1,4 +1,4 @@ -import { unescape } from 'lodash'; +import { unescape } from 'lodash' import TabSwitcher from '../tab_switcher/tab_switcher.js' import StyleSwitcher from '../style_switcher/style_switcher.vue'