core icon indicating copy to clipboard operation
core copied to clipboard

Cannot insert file, get JS error "Cannot read property 'search' of undefined"

Open svivian opened this issue 2 years ago • 1 comments

Trying to insert an file into a page doesn't work. In dev tools this JS error is given:

Uncaught TypeError: Cannot read property 'search' of undefined
    at p._truncateUrl (filelink.min.js:1)
    at p._createFileAndStore (filelink.min.js:1)
    at p._insert (filelink.min.js:1)
    at p.insertBySelect (filelink.min.js:1)

This is the standard page ContentType. The field is type: article. I click the File icon (right most one), then "Choose", then pick a file. Nothing happens, nothing is inserted. But there is this JS error in the dev tools.

Everything else works, I can type and add formatting. Similar error if using the upload tab:

Uncaught TypeError: Cannot read property 'search' of undefined
    at p._truncateUrl (filelink.min.js:1)
    at p._createFileAndStore (filelink.min.js:1)
    at p._insert (filelink.min.js:1)
    at p.insertByUpload (filelink.min.js:1)
    at p.api (article-editor.min.js:1)
    at p._complete (article-editor.min.js:1)
    at p.<anonymous> (article-editor.min.js:1)
    at i.loaded (article-editor.min.js:1)

I'm using v4.2.1 now but the error occurred in 4.1.22 and I upgraded to try and fix it, but no luck. I've made sure to clear Bolt's cache and do a hard reload in the browser to ensure I have the latest files.

Details

Question Answer
Relevant Bolt Version 4.2.1
Install type Composer
BC Break ?
PHP version 7.4
Web server Apache
For UX/UI issues Chrome, Firefox

svivian avatar Aug 20 '21 16:08 svivian

Seconded. Error appears at the end of the filelink plugin for the ArticleEditor. Variable "t" doesn't look like a String. I forcibly cast it to handle the javascript error but it doesn't retrieve the necessary data and show an "undefined" link instead.

Jackano avatar Oct 12 '21 08:10 Jackano