prevent reserved filenames on Windows

Fixes #82

Prevents filenames like COM1, ...
This commit is contained in:
Daniel Schadt 2017-03-24 11:36:19 +01:00
parent 9d905ebb5c
commit bc4430e5d9

View File

@ -23,6 +23,7 @@ import re
import sys
import os.path
import html
import pathlib
import collections
import sip
@ -657,6 +658,10 @@ class FilenamePrompt(_BasePrompt):
# E:filename is invalid
if re.match(r'[A-Z]:[^\\]', path, re.IGNORECASE):
return None
# Paths like COM1, ...
# See https://github.com/qutebrowser/qutebrowser/issues/82
if pathlib.Path(path).is_reserved():
return None
return path
def _show_error(self, msg):