Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47981

Drop events have broken mimeData()->urls() and text/uri-list.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.2
    • 5.5.0, 5.6.0
    • None
    • Arch Linux x86_64
    • 1108291e1a2e7de23440c2b36b2fd31010ae3f51

    Description

      Dropping URLs from certain sources result in corrupted URLs (mimeData()->urls()) in Qt 5. Qt 4.8.7 works fine here.

      Steps to reproduce:
      1. Launch the attached test program python drop.py 5 (Qt 5, broken) or python drop.py 4 (Qt 4, working).
      2. Open https://askubuntu.com/ in Firefox or Chromium.
      2. Drag and drop a URL from a page, from a bookmark and finally from the location bar to the program.

      Expected result (for Urls at least):

      Formats: ['text/x-moz-url', 'text/uri-list', '_NETSCAPE_URL', 'text/x-moz-url-data', 'text/x-moz-url-desc', 'text/html', 'text/unicode', 'text/plain;charset=utf-8', 'text/plain']
      Text: 'https://askubuntu.com/'
      Urls: [PyQt4.QtCore.QUrl('https://askubuntu.com/')]
      uri-list: PyQt4.QtCore.QByteArray(b'https://askubuntu.com/')
      
      Formats: ['text/x-moz-place', 'text/x-moz-url', 'text/uri-list', '_NETSCAPE_URL', 'text/unicode', 'text/plain;charset=utf-8', 'text/plain', 'text/html']
      Text: 'https://askubuntu.com/'
      Urls: [PyQt4.QtCore.QUrl('https://askubuntu.com/')]
      uri-list: PyQt4.QtCore.QByteArray(b'https://askubuntu.com/\r')
      
      Formats: ['text/x-moz-url', 'text/uri-list', '_NETSCAPE_URL', 'text/unicode', 'text/plain;charset=utf-8', 'text/plain', 'text/html']
      Text: 'https://askubuntu.com/'
      Urls: [PyQt4.QtCore.QUrl('https://askubuntu.com/')]
      uri-list: PyQt4.QtCore.QByteArray(b'https://askubuntu.com/')
      

      Actual result:

      Formats: ['text/uri-list', '_NETSCAPE_URL', 'text/x-moz-url-data', 'text/x-moz-url-desc', 'text/html', 'text/unicode', 'text/plain;charset=utf-8', 'text/plain']
      Text: 'https://askubuntu.com/'
      Urls: [PyQt5.QtCore.QUrl('https://askubuntu.com/')]
      uri-list: PyQt5.QtCore.QByteArray(b'https://askubuntu.com/')
      
      Formats: ['text/x-moz-place', 'text/uri-list', '_NETSCAPE_URL', 'text/unicode', 'text/plain;charset=utf-8', 'text/plain', 'text/html']
      Text: 'https://askubuntu.com/'
      Urls: [PyQt5.QtCore.QUrl(''), PyQt5.QtCore.QUrl('%00A%00s%00k%00 %00U%00b%00u%00n%00t%00u')]
      uri-list: PyQt5.QtCore.QByteArray(b'h\x00t\x00t\x00p\x00s\x00:\x00/\x00/\x00a\x00s\x00k\x00u\x00b\x00u\x00n\x00t\x00u\x00.\x00c\x00o\x00m\x00/\x00\r\x00\n\x00A\x00s\x00k\x00 \x00U\x00b\x00u\x00n\x00t\x00u\x00')
      
      Formats: ['text/uri-list', '_NETSCAPE_URL', 'text/unicode', 'text/plain;charset=utf-8', 'text/plain', 'text/html']
      Text: 'https://askubuntu.com/'
      Urls: [PyQt5.QtCore.QUrl('https://askubuntu.com/')]
      uri-list: PyQt5.QtCore.QByteArray(b'https://askubuntu.com/')
      

      Further information:
      Chromium is more severely affected, all of its URLs are wrongly detected:

      Formats: ['text/plain', 'text/html', 'text/uri-list', '_NETSCAPE_URL', 'chromium/x-renderer-taint']
      Text: 'https://askubuntu.com/'
      Urls: [PyQt5.QtCore.QUrl(''), PyQt5.QtCore.QUrl('%00A%00s%00k%00 %00U%00b%00u%00n%00t%00u')]
      uri-list: PyQt5.QtCore.QByteArray(b'h\x00t\x00t\x00p\x00s\x00:\x00/\x00/\x00a\x00s\x00k\x00u\x00b\x00u\x00n\x00t\x00u\x00.\x00c\x00o\x00m\x00/\x00\n\x00A\x00s\x00k\x00 \x00U\x00b\x00u\x00n\x00t\x00u\x00')
      
      Formats: ['text/plain', 'text/uri-list', '_NETSCAPE_URL', 'chromium/x-bookmark-entries']
      Text: 'https://askubuntu.com/'
      Urls: [PyQt5.QtCore.QUrl(''), PyQt5.QtCore.QUrl('%00A%00s%00k%00 %00U%00b%00u%00n%00t%00u')]
      uri-list: PyQt5.QtCore.QByteArray(b'h\x00t\x00t\x00p\x00s\x00:\x00/\x00/\x00a\x00s\x00k\x00u\x00b\x00u\x00n\x00t\x00u\x00.\x00c\x00o\x00m\x00/\x00\n\x00A\x00s\x00k\x00 \x00U\x00b\x00u\x00n\x00t\x00u\x00')
      
      Formats: ['text/plain', 'text/uri-list', '_NETSCAPE_URL']
      Text: 'https://askubuntu.com/'
      Urls: [PyQt5.QtCore.QUrl(''), PyQt5.QtCore.QUrl('%00A%00s%00k%00 %00U%00b%00u%00n%00t%00u')]
      uri-list: PyQt5.QtCore.QByteArray(b'h\x00t\x00t\x00p\x00s\x00:\x00/\x00/\x00a\x00s\x00k\x00u\x00b\x00u\x00n\x00t\x00u\x00.\x00c\x00o\x00m\x00/\x00\n\x00A\x00s\x00k\x00 \x00U\x00b\x00u\x00n\x00t\x00u\x00')
      

      Attachments

        1. drop.py
          0.8 kB
          Peter Wu

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              paeglis Gatis Paeglis
              Lekensteyn Peter Wu
              Votes:
              3 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes