Skip to content

Commit

Permalink
Decode entities when setting values for /me form inputs.
Browse files Browse the repository at this point in the history
The API takes care of encoding character but React components are re-encoding those characters on render.

Also, it seems the API does a good job filtering HTML tag injections.
  • Loading branch information
oskosk committed Nov 26, 2015
1 parent 103734d commit bc4f83b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client/me/form-base/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var debug = require( 'debug' )( 'calypso:me:form-base' );
/**
* Internal dependencies
*/
var notices = require( 'notices' );
var notices = require( 'notices' ),
formatting = require( 'lib/formatting' );

module.exports = {
componentDidMount: function() {
Expand Down Expand Up @@ -52,7 +53,7 @@ module.exports = {

valueLink: function( settingName ) {
return {
value: this.props.userSettings.getSetting( settingName ),
value: formatting.decodeEntities( this.props.userSettings.getSetting( settingName ) ),
requestChange: function( value ) {
this.props.userSettings.updateSetting( settingName, value );
}.bind( this )
Expand Down

0 comments on commit bc4f83b

Please sign in to comment.