Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

nixos/utils: Don't remove first character if not a /

+2 -1
+2 -1
nixos/lib/utils.nix
··· 5 5 # Escape a path according to the systemd rules, e.g. /dev/xyzzy 6 6 # becomes dev-xyzzy. FIXME: slow. 7 7 escapeSystemdPath = s: 8 - replaceChars ["/" "-" " "] ["-" "\\x2d" "\\x20"] (substring 1 (stringLength s) s); 8 + replaceChars ["/" "-" " "] ["-" "\\x2d" "\\x20"] 9 + (if hasPrefix "/" s then substring 1 (stringLength s) s else s); 9 10 10 11 }