editor-js / editor-js/image

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

Open
#248 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
285
Forks
307
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/editor-js/image/assets/99409050/7caa01d0-bce2-4669-8b42-17a69639069b)

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](https://github.com/editor-js/image/assets/99409050/8273f287-d8cd-4852-a272-f34b4ef81a27)

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](https://github.com/editor-js/image/assets/99409050/f396347e-ef28-481d-bab7-15dfd723e711)

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.