Add full stop to reserved character list

This commit is contained in:
Ed Rogers
2023-01-18 18:56:40 -06:00
parent 3bd5e94c34
commit 61da0c5c70
2 changed files with 5 additions and 4 deletions

View File

@@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `MouseScrollUp` and `MouseScrollDown` now inherit from `MouseEvent` and have attached modifier keys. https://github.com/Textualize/textual/pull/1458
- Fail-fast and print pretty tracebacks for Widget compose errors https://github.com/Textualize/textual/pull/1505
- The default filename for screenshots uses ISO8601 datetime format, with colons and spaces replaced with underscores https://github.com/Textualize/textual/pull/1518
- The default filename for screenshots uses a datetime format similar to ISO8601, but with reserved characters replaced by underscores https://github.com/Textualize/textual/pull/1518
### Fixed

View File

@@ -663,9 +663,10 @@ class App(Generic[ReturnType], DOMNode):
dt = datetime.now().isoformat()
else:
dt = datetime.now().strftime(time_format)
svg_filename = f"{self.title.lower()} {dt}.svg"
for reserved in ' <>:"/\\|?*':
svg_filename = svg_filename.replace(reserved, "_")
svg_filename_stem = f"{self.title.lower()} {dt}"
for reserved in ' <>:"/\\|?*.':
svg_filename_stem = svg_filename_stem.replace(reserved, "_")
svg_filename = svg_filename_stem + ".svg"
else:
svg_filename = filename
svg_path = os.path.expanduser(os.path.join(path, svg_filename))