mirror of
https://github.com/nix-community/disko.git
synced 2026-11-30 13:03:28 +01:00
fix: avoid calling splitString ""...
because it breaks evaluation on darwin with at least nix 2.18. Evaluating `lib.splitString "" "foo"` throws the following: `error: invalid regular expression ''`. We could avoid that by using lib.stringToCharacters, but as we are mapping over it anyway, lib.stringAsChars seems to be an even better fit. I tested the examples in hexEscapeUdevSymlinks docstring manually in a nix repl.
This commit is contained in:
1 parent
4be2aadf13
commit
09a776702b
1 file changed
+4
-7
+4
-7
@@ -105,15 +105,12 @@ let
|
||||
hexEscapeUdevSymlink "all0these@char#acters+_are-allow.ed"
|
||||
=> "all0these@char#acters+_are-allow.ed"
|
||||
*/
|
||||
hexEscapeUdevSymlink = with lib; let
|
||||
hexEscapeUdevSymlink = let
|
||||
allowedChars = "[0-9A-Za-z#+-.:=@_/]";
|
||||
charToHex = c: toHexString (strings.charToInt c);
|
||||
charToHex = c: lib.toHexString (lib.strings.charToInt c);
|
||||
in
|
||||
str: pipe str [
|
||||
(splitString "")
|
||||
(map (c: if match allowedChars c != null || c == "" then c else "\\x" + charToHex c))
|
||||
concatStrings
|
||||
];
|
||||
lib.stringAsChars
|
||||
(c: if lib.match allowedChars c != null || c == "" then c else "\\x" + charToHex c);
|
||||
|
||||
/* get the index an item in a list
|
||||
|
||||
|
||||
Reference in new issue
Block a user