Skip to content

Commit

Permalink
Merge pull request #738
Browse files Browse the repository at this point in the history
v4.1.10
  • Loading branch information
MatteoCampinoti94 authored Nov 1, 2024
2 parents 87517f9 + ad3ee5b commit 9b8804c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v4.1.10

### Fixes

* Fix `doctor` command adding underscores to files that required no fixing when sanitizing paths

## v4.1.9

### Changes
Expand Down
2 changes: 1 addition & 1 deletion digiarch/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "4.1.9"
__version__ = "4.1.10"
18 changes: 10 additions & 8 deletions digiarch/commands/doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,19 @@ def sanitize_paths(ctx: Context, database: FileDB, root: Path, dry_run: bool, *l
old_path: Path = file.relative_path
new_path: Path = sanitize_path(old_path)

if new_path == old_path:
continue

while file.root.joinpath(new_path).exists():
new_path = new_path.with_name("_" + new_path.name)

event: HistoryEntry = HistoryEntry.command_history(
ctx,
"sanitize-path.rename",
file.uuid,
[str(file.relative_path), str(new_path)],
)

if not dry_run:
file.root.joinpath(new_path).parent.mkdir(parents=True, exist_ok=True)
file.get_absolute_path().rename(file.root / new_path)
Expand All @@ -54,14 +64,6 @@ def sanitize_paths(ctx: Context, database: FileDB, root: Path, dry_run: bool, *l
except BaseException:
file.get_absolute_path().rename(file.root / old_path)
raise

event: HistoryEntry = HistoryEntry.command_history(
ctx,
"sanitize-path.rename",
file.uuid,
[str(file.relative_path), str(new_path)],
)
if not dry_run:
database.history.insert(event)

event.log(INFO, *(log for log in loggers if log))
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "digiarch"
version = "4.1.9"
version = "4.1.10"
description = "Tools for the Digital Archive Project at Aarhus Stadsarkiv"
authors = ["Aarhus Stadsarkiv <[email protected]>"]
license = "GPL-3.0"
Expand Down

0 comments on commit 9b8804c

Please sign in to comment.