mattmilburn/strapi-plugin-preview-button

"Open live view" button not visible if field have "%" char.

Miro0 opened this issue · 1 comments

I noticed following issue - tested with current version 2.2.1.

Minimum steps to reproduce:

  1. Defined minimum content type:
{
  "kind": "collectionType",
  "collectionName": "tests",
  "info": {
    "singularName": "test",
    "pluralName": "tests",
    "displayName": "Test",
    "description": ""
  },
  "attributes": {
    "Test": {
      "type": "string"
    }
  }
}
  1. Added plugin config:
'preview-button': {
    config: {
      contentTypes: [
        {
          uid: 'api::test.test',
          published: {
            url: `http://localhost:3000/test/{id}`,
            openTarget: '_blank',
          },
        }
      ],
    },
  },
  1. Content:
  • If there's no % char in field - Open live view exists:
    image
  • If there's % char in field - Open live view do not exists:
    image

There is also additional error in browser console:

main.c2325b99.js:2185 Uncaught (in promise) URIError: URI malformed
    at decodeURIComponent (<anonymous>)
    at main.c2325b99.js:2185:1707
    at Array.reduce (<anonymous>)
    at P (main.c2325b99.js:2185:1636)
    at z (main.c2325b99.js:2185:1952)
    at main.c2325b99.js:2185:3391

thrown in main.c2325b99.js:2185
image

Hi @Miro0 This was actually fixed in 2.2.1 🤔 Have you tried removing yarn.lock or node_modules and reinstalling with yarn? That encodeURIcomponent(decodeURIComponent(value)) code was definitely replaced in the latest version.