adept_remove: -O <dir> writes the result into a nested sub-directory when the input is a path #28
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
adept_remove -O <dir> <file>is documented as putting the de-DRMed result into<dir>. But when<file>is given as a path (absolute, or relative with sub-directories), the result is written to<dir>/<full input path>instead of<dir>/<basename>, and the intermediate directories are created silently.This is a natural usage: download with
acsmdownloaderinto one directory, then runadept_remove -O <other dir>on the resulting (absolute-path) file.Version
master(commit324c566, also tagv0.8.9), built on Ubuntu 24.04, g++ 13.Steps to reproduce
Expected
Result written to
/tmp/out/book.epub.Actual
Result written to
/tmp/out/tmp/in/book.epub— the whole/tmp/in/tree is re-created under/tmp/out/. No error or warning about the path.Root cause
utils/adept_remove.cpp,ADEPTRemove::run()(~line 88):inputFileis concatenated as-is (full path) afteroutputDir, thencreatePath()creates the nested directories. The input should be reduced to its base name first.acsmdownloader -Ois not affected because it builds the output name from the title metadata, not from the input path.Note: there is a prior commit
b44b988("Fix bug in utils with -o and -O options"); this specific case (input passed as a path) still reproduces on currentmaster.Fix
Reduce
inputFileto its base name before prefixing it withoutputDir. Tested on Ubuntu 24.04: with the patch,-O /tmp/out /tmp/in/book.epubcorrectly writes/tmp/out/book.epub.Thanks Benoît for your report and your fix.
Tested and approved !