core (memory/memory): fixed directory creation in setFile

This commit is contained in:
Goffi 2020-09-17 21:40:23 +02:00
commit 280f86881a

View file

@ -1568,6 +1568,7 @@ class Memory(object):
@param path(unicode, None): virtual path of the file in the namespace
if set, parent must be None. All intermediate directories will be created
if needed, using current access.
@param type_(str, None): type of file filter, can be one of C.FILE_TYPE_*
@param file_hash(unicode): unique hash of the payload
@param hash_algo(unicode): algorithm used for hashing the file (usually sha-256)
@param size(int): size in bytes
@ -1623,7 +1624,7 @@ class Memory(object):
if namespace is not None:
namespace = namespace.strip() or None
if type_ == C.FILE_TYPE_DIRECTORY:
if any(version, file_hash, size, mime_type):
if any((version, file_hash, size, mime_type)):
raise ValueError(
"version, file_hash, size and mime_type can't be set for a directory"
)