Private
Public Access
fix(twitter_threads): strip trailing slashes from --media-dir and --output
Path objects with trailing separators (e.g. './media/') intermittently
failed to glob on Windows after download_media.py had just finished
writing the directory. Normalize via rstrip('/\\\\') before Path()
re-wrapping so the CLI is forgiving regardless of OS path quirks.
Repro: gallery-dl ran + immediate render with trailing slash on the
just-created media/ dir -> glob returned nothing -> markdown emitted
no ![Media N] lines. Removing the trailing slash fixed it; this makes
both work.
This commit is contained in:
@@ -40,6 +40,8 @@ def main(argv: list[str] | None = None) -> int:
|
||||
parser.add_argument("--output", type=Path, required=True, help="media output directory")
|
||||
parser.add_argument("--cookies", type=Path, default=None, help="cookies.txt for gallery-dl auth")
|
||||
args = parser.parse_args(argv)
|
||||
args.output = Path(str(args.output).rstrip("/\\"))
|
||||
args.cookies = Path(str(args.cookies).rstrip("/\\")) if args.cookies is not None else None
|
||||
try:
|
||||
raw = args.input.read_text(encoding="utf-8")
|
||||
except OSError as e:
|
||||
|
||||
@@ -96,6 +96,8 @@ def main(argv: list[str] | None = None) -> int:
|
||||
parser.add_argument("--media-dir", type=Path, required=True, help="media directory to link")
|
||||
parser.add_argument("--output", type=Path, required=True, help="output .md path")
|
||||
args = parser.parse_args(argv)
|
||||
args.media_dir = Path(str(args.media_dir).rstrip("/\\"))
|
||||
args.output = Path(str(args.output).rstrip("/\\"))
|
||||
try:
|
||||
raw = args.input.read_text(encoding="utf-8")
|
||||
except OSError as e:
|
||||
|
||||
Reference in New Issue
Block a user