aboutsummaryrefslogtreecommitdiff
path: root/contrib/kiss-cargo-urlgen
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-04-04 16:56:55 +0000
committermerakor <cem@ckyln.com>2020-04-04 16:56:55 +0000
commit550ed08d342ed55bf1ae01ae94c131842126d705 (patch)
tree8ca72a447fce489e0a9c0af9db0f5b3e67d32a7a /contrib/kiss-cargo-urlgen
parent38b5f58b60e943d701b7c090df06348cb3321724 (diff)
downloadcpt-550ed08d342ed55bf1ae01ae94c131842126d705.tar.gz
kiss-cargo-urlgen: fix a bug that could lead to wrong url generation
FossilOrigin-Name: cd5cc11a50c0e269704d9846a3b9af54b7f6b43bf585c50540c2f16c802773d3
Diffstat (limited to 'contrib/kiss-cargo-urlgen')
-rwxr-xr-xcontrib/kiss-cargo-urlgen8
1 files changed, 6 insertions, 2 deletions
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