Catch errors of Windows API

This commit is contained in:
Markus Unterwaditzer 2015-02-08 14:57:53 +01:00
parent 2831e17ae1
commit ba4407af13

View file

@ -105,7 +105,10 @@ class FilesystemStorage(Storage):
href = self._deterministic_href(item)
return self._upload_impl(item, href)
except OSError as e:
if e.errno == errno.ENAMETOOLONG:
if e.errno in (
errno.ENAMETOOLONG, # Unix
errno.ENOENT # Windows
):
logger.debug('UID as filename rejected, trying with random '
'one.')
href = self._random_href()