From 550ed08d342ed55bf1ae01ae94c131842126d705 Mon Sep 17 00:00:00 2001 From: merakor Date: Sat, 4 Apr 2020 16:56:55 +0000 Subject: kiss-cargo-urlgen: fix a bug that could lead to wrong url generation FossilOrigin-Name: cd5cc11a50c0e269704d9846a3b9af54b7f6b43bf585c50540c2f16c802773d3 --- contrib/kiss-cargo-urlgen | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'contrib') diff --git a/contrib/kiss-cargo-urlgen b/contrib/kiss-cargo-urlgen index ba14aa9..9174edc 100755 --- a/contrib/kiss-cargo-urlgen +++ b/contrib/kiss-cargo-urlgen @@ -1,11 +1,15 @@ #!/bin/sh [ "$1" ] || { - printf 'usage: kiss-carg-urlgen [crate-ver] [crate-ver]\n' + printf 'usage: kiss-carg-urlgen [crate+ver] [crate+ver]\n' exit 1 } +# We convert the name-version seperator from '+' to '-' to +# avoid issues that may arise from version numbers that include +# a '-'. + for crate in "$@"; do printf 'https://static.crates.io/crates/%s/%s.crate vendor\n' \ - "${crate%-*}" "$crate" + "${crate%+*}" "$(echo "$crate" | sed 's/+/-/')" done -- cgit v1.2.3