Init accepts invalid snapshot ids

Please describe what you are doing to trigger the bug:

duplicacy init bad/id /share/TR-004/Duplicacy/storage

Please describe what you expect to happen (but doesn’t):

Expect error message because snapshot id includes an invalid character “/”.

Please describe what actually happens (the wrong behaviour):

[/share/TR-004/HBS Backup] # duplicacy init bad/id /share/TR-004/Duplicacy/storage
The storage '/share/TR-004/Duplicacy/storage' has already been initialized
Compression level: 100
Average chunk size: 4194304
Maximum chunk size: 16777216
Minimum chunk size: 1048576
Chunk seed: 6475706c6963616379
/share/TR-004/HBS Backup will be backed up to /share/TR-004/Duplicacy/storage with id bad/id

[/share/TR-004/HBS Backup] # duplicacy backup -dry-run
Storage set to /share/TR-004/Duplicacy/storage
Failed to list the revisions of the snapshot bad/id: mkdir /share/TR-004/Duplicacy/storage/snapshots/bad/id: no such file or directory

See also https://forum.duplicacy.com/t/inaccessible-snapshot-id-with-slash/4324?u=gorlen

3 Likes

I added a check to reject snapshot ids with invalid characters: Validate the repository id for the init and add command · gilbertchen/duplicacy@5eed6c6 · GitHub

2 Likes