Project

General

Profile

Actions

Bug #13961

open

WTextEdit.js: TypeError: can't access property "indexOf"

Added by Matthias Van Ceulebroeck 9 days ago. Updated 9 days ago.

Status:
Review
Priority:
Normal
Assignee:
-
Target version:
Start date:
09/08/2025
Due date:
% Done:

0%

Estimated time:

Description

In the JS code of the WTextEdit, upon a clipboard paste event, code is executed to ensure that images can be pasted correctly.
The images are inserted as a data URL.

To check whether the pasted content is actually an image, a check is executed for each i, that looks like:

let t = event.clipboardData.types[i];
if ((t.indexOf("image/") === 0) || (t.type.indexOf("image/") === 0)) {
  // create image from data URL
}

Here, the t.type is suspect. The t itself ought to contain a string with a MIME type, according to MDN documentation.
It seems that an older refactoring broke this. The check used to be on clipboardData.types[i] and clipboardData.items[i].type.

Actions #1

Updated by Matthias Van Ceulebroeck 9 days ago

  • Status changed from InProgress to Review
  • Assignee deleted (Matthias Van Ceulebroeck)
Actions

Also available in: Atom PDF