From ba8307c27eca53240f8095ab7df1045fdec47f0a Mon Sep 17 00:00:00 2001 From: Tim Schuster Date: Sat, 8 Jul 2017 15:19:43 +0200 Subject: [PATCH] Quick Fix for Wrong Argument Splitting on wget When setting the user agent, the resulting CLI arguments for wget where `['wget', '--timestamping', '--adjust-extension', '--no-parent', '--page-requisites', '--convert-links', '-', '-', 'u', 's', 'e', 'r', '-', 'a', 'g', 'e', 'n', 't', '=', '"', 'L', 'y', 'n', 'x', '"', 'https://example.org']`, with this fix it turns into `['wget', '--timestamping', '--adjust-extension', '--no-parent', '--page-requisites', '--convert-links', '--user-agent="Lynx"', '', 'https://example.org']` --- fetch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch.py b/fetch.py index 16c5dd4d..15b0f5b7 100644 --- a/fetch.py +++ b/fetch.py @@ -33,7 +33,7 @@ def fetch_wget(out_dir, link, overwrite=False, requisites=True, timeout=TIMEOUT) CMD = [ *'wget --timestamping --adjust-extension --no-parent'.split(' '), # Docs: https://www.gnu.org/software/wget/manual/wget.html *(('--page-requisites', '--convert-links') if requisites else ()), - *(('--user-agent="{}"'.format(WGET_USER_AGENT)) if WGET_USER_AGENT else ()), + *(('--user-agent="{}"'.format(WGET_USER_AGENT), '') if WGET_USER_AGENT else ()), link['url'], ] end = progress(timeout, prefix=' ')