Nix: Fix name characters in prefetch.
This commit is contained in:
parent
372ba8bfad
commit
033901dfd7
|
@ -51,13 +51,15 @@
|
||||||
# Usage: prefetch <URL>
|
# Usage: prefetch <URL>
|
||||||
function prefetch() {
|
function prefetch() {
|
||||||
local url="''${1}"
|
local url="''${1}"
|
||||||
|
local name="''${1##*/}"
|
||||||
|
name=$(parse_alnum "''${name%%\?*}")
|
||||||
|
|
||||||
if [[ "''${url}" = "" ]]; then
|
if [[ "''${url}" = "" ]]; then
|
||||||
help prefetch
|
help prefetch
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local result=$(nix hash convert --to sri --hash-algo sha256 $(nix-prefetch-url "''${url}"))
|
local result=$(nix hash convert --to sri --hash-algo sha256 $(nix-prefetch-url --name "''${name}" "''${url}"))
|
||||||
printf "%s" ''${result} | copy
|
printf "%s" ''${result} | copy
|
||||||
printf "%s\n" ''${result}
|
printf "%s\n" ''${result}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue