[vlc-commits] [Git][videolan/vlc][master] qt: handle non-`text/uri-list` multi-line text drop properly

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Oct 31 11:07:53 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
176e312e by Fatih Uzunoglu at 2024-10-31T10:52:43+00:00
qt: handle non-`text/uri-list` multi-line text drop properly

A single URL can not contain multiple lines. If the input is
multi-line text, then it should be treated as multiple urls,
not a single url.

This is with accordance to `text/uri-list`, the main difference
is being more relaxed regarding the line ending. Unlike
`text/uri-list`, CRLF line ending is not mandatory and LF is
enough.

- - - - -


1 changed file:

- modules/gui/qt/maininterface/qml/MainInterface.qml


Changes:

=====================================
modules/gui/qt/maininterface/qml/MainInterface.qml
=====================================
@@ -253,7 +253,12 @@ Item {
                        so check if mimedata has valid url in text and use it
                        if we didn't get any normal Urls()*/
 
-                    urls.push(drop.text)
+                    if (drop.text.includes("\n")) {
+                        const normalizedLineEndingsDropText = drop.text.replace("\r\n", "\n")
+                        urls.push(...normalizedLineEndingsDropText.split("\n"))
+                    } else {
+                        urls.push(drop.text)
+                    }
                 }
 
                 if (urls.length > 0) {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/176e312e48d40cfceacc909ae6cdaea73d781cbf

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/176e312e48d40cfceacc909ae6cdaea73d781cbf
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list