From a7550a4d8404a9f0b0bcfeaecfef050619cb24d0 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Thu, 7 Nov 2024 20:14:51 -0600 Subject: [PATCH] urls: improve ``derive-url`` to coerce the arguments to urls. --- basis/urls/urls-docs.factor | 6 ++++++ basis/urls/urls.factor | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/basis/urls/urls-docs.factor b/basis/urls/urls-docs.factor index 491fe248059..778e5c9b894 100644 --- a/basis/urls/urls-docs.factor +++ b/basis/urls/urls-docs.factor @@ -62,6 +62,12 @@ HELP: derive-url "URL\" master-cleanser\" derive-url ." "URL\" http://www.truecasey.com/drinks/master-cleanser\"" } + { $example + "USING: prettyprint urls ;" + "\"https://factorcode.org\"" + "\"index.html\" derive-url ." + "URL\" https://factorcode.org/index.html\"" + } } ; HELP: ensure-port diff --git a/basis/urls/urls.factor b/basis/urls/urls.factor index 33eeb94b2ec..60ec6aa039a 100644 --- a/basis/urls/urls.factor +++ b/basis/urls/urls.factor @@ -179,7 +179,7 @@ PRIVATE> PRIVATE> : derive-url ( base url -- url' ) - [ clone ] dip over { + [ >url clone ] dip >url over { [ [ protocol>> ] either? >>protocol ] [ [ username>> ] either? >>username ] [ [ password>> ] either? >>password ]