Sanitize block configuration input?

Created on 5 November 2020, about 4 years ago
Updated 14 June 2023, over 1 year ago

Problem/Motivation

If a user enters a quotation mark into a custom block admin field, the field does not display in the app frontend.

Steps to reproduce

Here's a stripped down version of my app, haven't tested if this actually works, this is just for demo purposes:

Vue.component('calculator', {
  template: '<div class="my-calculator">' +
    '<p>{{ introText }}</p>' +
    '</div>',
   props: ['introTextField', 'instanceId'],
    mounted: function () {
    // Create Vue variables out of user defined variables.
    if (this.introTextField) { this.introText = this.introTextField; }
  },
    data: function () {
    return {
      introText: null,
    }
  },
   methods: {
  },
});

I followed the documentation to create a custom field in my .info.yml and set it up as a component.

configuration:
  introTextField:
    type: textarea
    title: 'Intro text'
    default_value: 'Default value text here.'

Proposed resolution

I'd like to know if there's a way to sanitize the user input to remove quotation marks or convert them to html.

πŸ’¬ Support request
Status

Fixed

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cfbauer San Diego, CA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024