Skip to content

Commit 8cf7d3d

Browse files
Merge pull request rudolfochrist#15 from frejanordsiek/make-curl-call-not-use-shell
Made call to curl use a list of command and arguments rather than using a string with the shell
2 parents ec7a164 + f66f68a commit 8cf7d3d

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

ql-https.lisp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,20 @@
1717
"Fetch URL and safe it to FILE."
1818
(declare (ignorable args))
1919
(if (uiop:string-prefix-p "https://" url)
20-
(let ((output (uiop:run-program (format nil "curl -fsSL ~A -o ~A" url file)
21-
:output '(:string :stripped t)
22-
:error-output :output))
23-
(file (and file (probe-file file)))
24-
(release (url-to-release url)))
20+
;; Convert the file path to a string with any leading "~" replaced by the
21+
;; HOME directory, and then download.
22+
(let* ((file-namestring (namestring file))
23+
(file-namestring-full (if (uiop:string-prefix-p "~" file-namestring)
24+
(concatenate 'string
25+
(namestring (user-homedir-pathname))
26+
(subseq file-namestring 1))
27+
file-namestring))
28+
(output (uiop:run-program (list "curl" "-fsSL" url "-o" file-namestring-full)
29+
:force-shell nil
30+
:output '(:string :stripped t)
31+
:error-output :output))
32+
(file (and file (probe-file file)))
33+
(release (url-to-release url)))
2534
(when release
2635
(verify-download file release))
2736
(values output file))

0 commit comments

Comments
 (0)