From e406a9f1ee7e3c2bf4c5f99d560518cc681cf9f9 Mon Sep 17 00:00:00 2001 From: retropikzel Date: Thu, 2 Jul 2026 15:05:03 +0300 Subject: [PATCH] download-file: Limit to http or https urls only --- retropikzel/download-file.scm | 8 +++++--- retropikzel/download-file/README.md | 2 +- retropikzel/download-file/VERSION | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/retropikzel/download-file.scm b/retropikzel/download-file.scm index 5ceb907..320437e 100644 --- a/retropikzel/download-file.scm +++ b/retropikzel/download-file.scm @@ -41,6 +41,11 @@ (list->string result))) (define (download-file url . download-path) + (when (< (string-length url) 4) + (error "download-file error: url too short" url)) + (when (and (not (string=? (string-copy url 0 4) "http")) + (not (string=? (string-copy url 0 5) "https"))) + (error "download-file error: only http or https urls supported" url)) (when (not (string? url)) (error "download-file error: url must be string" url)) (when (and (not (null? download-path)) @@ -55,9 +60,6 @@ (file-mode-cbv (string->c-bytevector "w")) (to-file-cbv (c-fopen to-path-cbv file-mode-cbv)) (url-cbv (string->c-bytevector url))) - (display "HERE: to-path ") - (write to-path) - (newline) (when (c-bytevector-null? to-file-cbv) (let* ((error-message "download-file error") (error-pointer (string->c-bytevector error-message))) diff --git a/retropikzel/download-file/README.md b/retropikzel/download-file/README.md index 7657495..658de82 100644 --- a/retropikzel/download-file/README.md +++ b/retropikzel/download-file/README.md @@ -1 +1 @@ -Download file +Download file using HTTP or HTTPS. diff --git a/retropikzel/download-file/VERSION b/retropikzel/download-file/VERSION index 6e8bf73..3eefcb9 100644 --- a/retropikzel/download-file/VERSION +++ b/retropikzel/download-file/VERSION @@ -1 +1 @@ -0.1.0 +1.0.0