aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2026-09-20 23:39:32 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2026-09-22 12:34:02 -0400
commit198bb75e15c98e971a92ee841486d6ccbd95c8e7 (patch)
tree61bfdc21aa7315053577d6c0c14155cf524f294c /org
parentocda db: before writing check carried file names (diff)
downloads: honour --allow-downloads
The flag has existed since a url argument could be fetched and nothing ever read it, so every url was fetched whether or not the flag was given. A refused url is now dropped from the arguments, which is what a failed download already did. (assisted by Claude-Code)
Diffstat (limited to 'org')
-rw-r--r--org/spine.org12
1 files changed, 11 insertions, 1 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;