aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
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 /src
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 'src')
-rw-r--r--src/sisudoc/spine.d12
1 files changed, 11 insertions, 1 deletions
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;