Project

General

Profile

Actions

Bug #13961

closed
MV MV

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

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

Added by Matthias Van Ceulebroeck about 1 year ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
09/08/2025
Due date:
% Done:

100%

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.

MV Updated by Matthias Van Ceulebroeck about 1 year ago Actions #1

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

RM Updated by Romain Mardulyn 12 months ago Actions #2

  • Assignee set to Romain Mardulyn

MV Updated by Matthias Van Ceulebroeck 10 months ago Actions #3

  • Status changed from Review to Implemented @Emweb
  • Assignee changed from Romain Mardulyn to Matthias Van Ceulebroeck
  • % Done changed from 0 to 100

RM Updated by Romain Mardulyn 7 months ago Actions #4

  • Status changed from Implemented @Emweb to Closed
Actions

Also available in: PDF Atom