nix-prefetch-git: fix url_to_name heuristic

The function wasn't checking that *all* of the characters where
[a-z0-9]. Fixes #13921
This commit is contained in:
zimbatm 2016-03-18 19:47:19 +00:00
parent 89fd501441
commit 40e9dff04a

View File

@ -118,7 +118,7 @@ url_to_name(){
# basename removes the / and .git suffixes
local base=$(basename "$url" .git)
if [[ $ref =~ [a-z0-9]+ ]]; then
if [[ $ref =~ ^[a-z0-9]+$ ]]; then
echo "$base-${ref:0:7}"
else
echo $base