aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/in_zip_pod.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2026-09-11 14:26:09 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2026-09-12 12:14:40 -0400
commit25d3ab8e6524697ab3f2972f6dba1fbe26fcb0ec (patch)
treee524e09405ea3956b9838e03b0c46e9b0575f631 /org/in_zip_pod.org
parentocda: the images an artefact carries, and the ones it only describes (diff)
spine: a .ocda.db can be fetched, as a pod zip can
A URL ending in .ocda.db is now downloaded and processed in place, through the path that already did it for .zip: the same curl call, the same size and timeout limits, the same refusal of local and private addresses, the same --allow-downloads guard, the same temp file cleanup. Only the pattern had to widen. rgx_url_zip ^https?://...[.]zip$ rgx_url_source ^https?://...([.]zip|[.]ocda[.]db)$ downloadZipUrl is no downloadSourceUrl and the download temp directory is spine-download rather than spine-zip-pod; (the extraction directory keeps its name, being still only for zips). (assisted by Claude-Code)
Diffstat (limited to 'org/in_zip_pod.org')
-rw-r--r--org/in_zip_pod.org15
1 files changed, 10 insertions, 5 deletions
diff --git a/org/in_zip_pod.org b/org/in_zip_pod.org
index 9beae6e..3ab3238 100644
--- a/org/in_zip_pod.org
+++ b/org/in_zip_pod.org
@@ -245,7 +245,12 @@ template spineExtractZipPod() {
enum size_t MAX_DOWNLOAD_SIZE = 200 * 1024 * 1024; /+ 200 MB download limit +/
enum int DOWNLOAD_TIMEOUT = 120; /+ seconds +/
- static auto rgx_url_zip = ctRegex!(`^https?://[a-zA-Z0-9._:/-]+[.]zip$`);
+ /+ ↓ the sources that can be fetched whole: a pod zip, and a .ocda.db,
+ which is the one other artefact self-sufficient enough to travel on
+ its own, carrying its images. A .ssp is not here: it describes its
+ images without carrying them, so it would arrive without them.
+ +/
+ static auto rgx_url_source = ctRegex!(`^https?://[a-zA-Z0-9._:/-]+([.]zip|[.]ocda[.]db)$`);
struct DownloadResult {
string local_path; /+ path to downloaded temp file +/
@@ -258,7 +263,7 @@ template spineExtractZipPod() {
&& (arg[0..8] == "https://" || arg[0..7] == "http://");
}
- @trusted DownloadResult downloadZipUrl(string url) {
+ @trusted DownloadResult downloadSourceUrl(string url) {
import std.process : execute, environment;
DownloadResult result;
result.ok = false;
@@ -271,8 +276,8 @@ template spineExtractZipPod() {
stderr.writeln("WARNING: downloading over insecure http: ", url);
}
/+ ↓ validate URL format +/
- if (!(url.matchFirst(rgx_url_zip))) {
- result.error_msg = "URL does not match expected zip URL pattern: " ~ url;
+ if (!(url.matchFirst(rgx_url_source))) {
+ result.error_msg = "URL is not a .zip pod or a .ocda.db: " ~ url;
return result;
}
/+ ↓ reject URLs that could target internal services +/
@@ -312,7 +317,7 @@ template spineExtractZipPod() {
return result;
}
/+ ↓ create temp directory for download +/
- string tmp_base = tempDir.buildPath("spine-zip-pod");
+ string tmp_base = tempDir.buildPath("spine-download");
try {
if (!exists(tmp_base))
mkdirRecurse(tmp_base);