diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index 3f8bf116c..5a95e4a00 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -296,10 +296,10 @@ class DownloadItem(QObject): else: self.set_fileobj(fileobj) - def _ask_overwrite_question(self): + def _ask_confirm_question(self, msg): """Create a Question object to be asked.""" q = usertypes.Question(self) - q.text = self._filename + " already exists. Overwrite? (y/n)" + q.text = msg + ' (N/y)' q.mode = usertypes.PromptMode.yesno q.answered_yes.connect(self._create_fileobj) q.answered_no.connect(functools.partial(self.cancel, False)) @@ -452,7 +452,14 @@ class DownloadItem(QObject): if os.path.isfile(self._filename): # The file already exists, so ask the user if it should be # overwritten. - self._ask_overwrite_question() + self._ask_confirm_question(self._filename + + " already exists. Overwrite?") + # FIFO, device node, etc. Make sure we want to do this + elif (os.path.exists(self._filename) and not + os.path.isdir(self._filename)): + self._ask_confirm_question(self._filename + + " already exists and is a special file." + " Write to this?") else: self._create_fileobj()