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:
sternenseemann 2021-05-04 15:07:56 +02:00
parent 326d0970e0
commit f39a5c4e50

View File

@ -667,7 +667,7 @@ rec {
=> false
*/
isStorePath = x:
if isCoercibleToString x then
if !(isList x) && isCoercibleToString x then
let str = toString x; in
substring 0 1 str == "/"
&& dirOf str == storeDir