From 076905170ecb09f58c77b73602eae935aebddda0 Mon Sep 17 00:00:00 2001 From: dennisvang <29799340+dennisvang@users.noreply.github.com> Date: Wed, 6 Sep 2023 10:28:13 +0200 Subject: [PATCH] handle 8.3 filenames in Repository.save_config() --- src/tufup/repo/__init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/tufup/repo/__init__.py b/src/tufup/repo/__init__.py index fc362eb..27523a6 100644 --- a/src/tufup/repo/__init__.py +++ b/src/tufup/repo/__init__.py @@ -580,12 +580,17 @@ def save_config(self): for key in ['repo_dir', 'keys_dir']: try: temp_config_dict[key] = temp_config_dict[key].relative_to( - pathlib.Path.cwd() + # resolve() is necessary on windows, to handle "short" + # path components (a.k.a. "8.3 filename" or "8.3 alias"), + # which are truncated with a tilde, + # e.g. c:\Users\RUNNER~1\... + pathlib.Path.cwd().resolve() ) except ValueError: logger.warning( - f'Saving *absolute* path in config, because the path is' - f' not relative to cwd: {temp_config_dict[key]}' + f'Saving *absolute* path to config, because the path' + f' ({temp_config_dict[key]}) is not relative to cwd' + f' ({pathlib.Path.cwd()})' ) # write file config_file_path.write_text(