JS error on adding PDF file
-
Hi!
If I try to add an attachment (PDF file), the following JS error happens:
Uncaught TypeError: Cannot read properties of undefined (reading ‘thumbnail’)
in scripts.js line 27:if (attachment[i].sizes.thumbnail !== undefined ) url_image=attachment[i].sizes.thumbnail.url;
The reason is, that the attachment object does not contain a property “sizes”, perhaps because it is a PDF file without preview image.
But it has a “icon” property with the value of “/wp-includes/images/media/document.png”. Perhaps as a fallback, that should be used.Could you please fix this?
Thanks,
Marc
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘JS error on adding PDF file’ is closed to new replies.