aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc/ocda/io_in
diff options
context:
space:
mode:
Diffstat (limited to 'src/sisudoc/ocda/io_in')
-rw-r--r--src/sisudoc/ocda/io_in/read_zip_pod.d15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/sisudoc/ocda/io_in/read_zip_pod.d b/src/sisudoc/ocda/io_in/read_zip_pod.d
index 322382d..ea1fa1b 100644
--- a/src/sisudoc/ocda/io_in/read_zip_pod.d
+++ b/src/sisudoc/ocda/io_in/read_zip_pod.d
@@ -269,7 +269,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 +/
@@ -282,7 +287,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;
@@ -295,8 +300,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 +/
@@ -336,7 +341,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);