diff --git a/lib/strings.nix b/lib/strings.nix index a903aa9fbc49..fa3cdd9711e4 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -155,8 +155,8 @@ rec { preLen = stringLength pre; sLen = stringLength s; in - if pre == substring 0 preLen s then - substring preLen (sub sLen preLen) s + if hasPrefix pre s then + substring preLen (sLen - preLen) s else s;