diff options
| -rw-r--r-- | org/spine.org | 12 | ||||
| -rw-r--r-- | src/sisudoc/spine.d | 12 |
2 files changed, 22 insertions, 2 deletions
diff --git a/org/spine.org b/org/spine.org index 0893b96..c93e334 100644 --- a/org/spine.org +++ b/org/spine.org @@ -498,7 +498,7 @@ auto helpInfo = getopt(args, std.getopt.config.passThrough, "abstraction", "document abstraction", &opts["abstraction"], "abstraction-db", "document abstraction (write ocda.db sqlite file)", &opts["abstraction-db"], - "allow-downloads", "allow downloads (includes cgi.d from github)", &opts["allow-downloads"], + "allow-downloads", "allow a url argument to be fetched (zip or db)", &opts["allow-downloads"], "assert", "set optional assertions on", &opts["assertions"], "cgi-bin-root", "path to cgi-bin directory", &settings["cgi-bin-root"], "cgi-url-root", "url to cgi-bin (to find cgi-bin)", &settings["cgi-url-root"], @@ -1284,6 +1284,16 @@ DownloadResult[] _url_downloads; string[] _resolved_args; foreach (arg; args[1..$]) { if (isUrl(arg)) { + /+ ↓ --allow-downloads makes fetching an argument opt in. + the flag has existed since downloads were added but was not + read; every url argument was fetched. A refused url is dropped + from the arguments, which is what a failed download already does. + +/ + if (!(_opt_action.allow_downloads)) { + writeln("ERROR >> Refused to fetch: ", arg, + " - fetching a url source requires --allow-downloads"); + continue; + } auto _dlr = downloadSourceUrl(arg); if (_dlr.ok) { _url_downloads ~= _dlr; diff --git a/src/sisudoc/spine.d b/src/sisudoc/spine.d index 9cc7b4a..07f04be 100644 --- a/src/sisudoc/spine.d +++ b/src/sisudoc/spine.d @@ -240,7 +240,7 @@ string program_name = "spine"; std.getopt.config.passThrough, "abstraction", "document abstraction", &opts["abstraction"], "abstraction-db", "document abstraction (write ocda.db sqlite file)", &opts["abstraction-db"], - "allow-downloads", "allow downloads (includes cgi.d from github)", &opts["allow-downloads"], + "allow-downloads", "allow a url argument to be fetched (zip or db)", &opts["allow-downloads"], "assert", "set optional assertions on", &opts["assertions"], "cgi-bin-root", "path to cgi-bin directory", &settings["cgi-bin-root"], "cgi-url-root", "url to cgi-bin (to find cgi-bin)", &settings["cgi-url-root"], @@ -1000,6 +1000,16 @@ string program_name = "spine"; string[] _resolved_args; foreach (arg; args[1..$]) { if (isUrl(arg)) { + /+ ↓ --allow-downloads makes fetching an argument opt in. + the flag has existed since downloads were added but was not + read; every url argument was fetched. A refused url is dropped + from the arguments, which is what a failed download already does. + +/ + if (!(_opt_action.allow_downloads)) { + writeln("ERROR >> Refused to fetch: ", arg, + " - fetching a url source requires --allow-downloads"); + continue; + } auto _dlr = downloadSourceUrl(arg); if (_dlr.ok) { _url_downloads ~= _dlr; |
