mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
lib/strings: forbid lists in isStorePath
When a list is passed to isStorePath this is most likely a mistake and it is therefore better to just return false. There is one case where this theoretically makes sense (if a list contains a single element for which isStorePath elem), but since that case is also probably seldomly intentional, it may save someone from debbuging unclear evaluation errors.
This commit is contained in:
parent
326d0970e0
commit
f39a5c4e50
@ -667,7 +667,7 @@ rec {
|
|||||||
=> false
|
=> false
|
||||||
*/
|
*/
|
||||||
isStorePath = x:
|
isStorePath = x:
|
||||||
if isCoercibleToString x then
|
if !(isList x) && isCoercibleToString x then
|
||||||
let str = toString x; in
|
let str = toString x; in
|
||||||
substring 0 1 str == "/"
|
substring 0 1 str == "/"
|
||||||
&& dirOf str == storeDir
|
&& dirOf str == storeDir
|
||||||
|
Loading…
Reference in New Issue
Block a user