fix(StatusChatInput): handle non standard DND MIME types

- most browsers will pass a standard `text/uri-list` MIME type, however
Chrome uses `text/x-moz-url` so we handle that separately
(`drop.hasUrls` is `false` in this case)
This commit is contained in:
Lukáš Tinkl 2023-06-07 18:03:38 +02:00 committed by Lukáš Tinkl
parent ebbd259754
commit 4bf09e2b84
1 changed files with 9 additions and 1 deletions

View File

@ -943,7 +943,15 @@ Rectangle {
target: Global.dragArea
ignoreUnknownSignals: true
function onDroppedOnValidScreen(drop) {
if (validateImagesAndShowImageArea(drop.urls)) {
let dropUrls = drop.urls
if (!drop.hasUrls) {
console.warn("Trying to drop, list of URLs is empty tho; formats:", drop.formats)
if (drop.formats.includes("text/x-moz-url")) { // Chrome uses a non-standard MIME type
dropUrls = drop.getDataAsString("text/x-moz-url")
}
}
if (validateImagesAndShowImageArea(dropUrls)) {
drop.acceptProposedAction()
}
}