Commits

Anonymous committed 161fbab

repowidget: stop treating dragged binary files as patches

Dragging a large binary file over any part of the workbench (even when the
workbench is sitting in the background behind other windows) will cause the
repowidget's dragEnterEvent to try to parse the file as a patch. This will
cause the workbench (as well as the file explorer window from which the drag
originated) to hang for several seconds.

  • Participants
  • Parent commits 6d9d245
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/repowidget.py

                 continue
             try:
                 pf = open(p, 'rb')
+                earlybytes = pf.read(4096)
+                if '\0' in earlybytes:
+                    continue
+                pf.seek(0)
                 filename, message, user, date, branch, node, p1, p2 = \
                         patch.extract(self.repo.ui, pf)
                 if filename: