diff --git a/CHANGES.rst b/CHANGES.rst index 2d1eca30e..384c12ab2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -73,6 +73,7 @@ Unreleased :pr:`2620` - The development server discards header keys that contain underscores ``_``, as they are ambiguous with dashes ``-`` in WSGI. :pr:`2621` +- ``secure_filename`` looks for more Windows reserved file names. :pr:`2622` Version 2.2.3 diff --git a/src/werkzeug/utils.py b/src/werkzeug/utils.py index bebe43876..b4c9d0f0d 100644 --- a/src/werkzeug/utils.py +++ b/src/werkzeug/utils.py @@ -31,19 +31,14 @@ _entity_re = re.compile(r"&([^;]+);") _filename_ascii_strip_re = re.compile(r"[^A-Za-z0-9_.-]") -_windows_device_files = ( +_windows_device_files = { "CON", - "AUX", - "COM1", - "COM2", - "COM3", - "COM4", - "LPT1", - "LPT2", - "LPT3", "PRN", + "AUX", "NUL", -) + *(f"COM{i}" for i in range(10)), + *(f"LPT{i}" for i in range(10)), +} class cached_property(property, t.Generic[_T]):