Closed Bug 1642158 Opened 4 years ago Closed 3 years ago

Paste text/uri-list as files instead of links

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, enhancement)

76 Branch
enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1699743

People

(Reporter: vaartis, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0

Steps to reproduce:

Pasted data from clipboard that has a MIME-type text/uri-list

Actual results:

Firefox pastes it as a link

Expected results:

Firefox uploads the file that the link refers to (or, perhaps, only uploads it if it's a file:// link). This already happens when drag-and-dropping text/uri-list. It would be logical to handle it the same way for copying-and-pasting.

Perhaps, this could also be extended to handle text/x-moz-url, which would potentially contain an alternative name of the file.

Hi,

I'm setting component to this enhancement to Core - Layout. Please set the right component in case is needed. Also I'm setting status to NEW.

Thanks.

Status: UNCONFIRMED → NEW
Component: Untriaged → Layout
Ever confirmed: true
Product: Firefox → Core
Component: Layout → DOM: Selection

Could you tell us how to reproduce the reported bug? (how to create the clipboard data? and where to paste the clipboard data?)

Flags: needinfo?(vaartis)

My concrete example would be any program which uses QMimeData and QApplication.clipboard().setMimeData(). The exact program that I found this do is hydrus, but it can probably be easily replicated as a standalone example using just these two types in Qt5/PyQt5. As about where to paste the clipboard data, that would be the fields that accept pasting or dropping files into them to upload these files. If I am not mistaken, the "pasting" is implemented via ClipboardEvent and is achieved by listening to the "paste" event, while dropping is achieved by listening to the "drop" event, both produce the DataTransfer object, with the "files" property, but when drag-and-dropping, the file:// urls are converted to "files" and when pasting they're not. The idea would be to convert these pasted file:// URLs to file data inside DataTransfer. There are more than one website that do it, my concrete example would be this but I'm pretty sure you can go on any social media website (e.g. twitter, facebook) and they would do the same thing.

Flags: needinfo?(vaartis)
Severity: -- → S4
Component: DOM: Selection → DOM: Copy & Paste and Drag & Drop

In bug 1701319 I added support for pasting files on the GTK platform by parsing the text/uri-list data. However without bug 1699743/bug 1308007 fixed we don't actually support pasting files on websites.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.