editor-js / image

Image Block for Editor.js
MIT License
238 stars 287 forks source link

Pasting a picture from the clipboard after pasting a picture URL from the clipboard #248

Open mkkkjhn opened 5 months ago

mkkkjhn commented 5 months ago

hey! I found a problem I haven't found a solution to yet.

When I use the "Uploading by pasted URL" script to paste a copied file from the clipboard, I run into an unusual problem. The file is passed inside the POST request incorrectly.

Below I will show this story in screenshots:

  1. First, I copy the picture "as file" and paste it into the editor. Payload of the request looks like this: debug1

  2. Next, I paste the picture into the editor by copying and pasting its URL

  3. Finaly, I copy the picture "as file" and paste it into the editor again. And here is how the request payload looks like in this case: debug2

my server to which I make a request responds that it can't find the value of the "file" key. This name is specified in my config as "field". The problem looks like something goes wrong in the "uploadByFile" function (on the screen) when forming the "formData" object. I logged the contents of this object right before the request and it looks identical in both scenarios, which is just confusing: image

Please help with the investigation of this bug, I am suffering a lot because of it

neSpecc commented 5 months ago

I'm not sure about it. If you have a time, please, debug it deeper. I'll try to help.