Skip to content

Commit

Permalink
handle 8.3 filenames in Repository.save_config()
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisvang committed Sep 6, 2023
1 parent d460947 commit 0769051
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/tufup/repo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 0769051

Please sign in to comment.