fix: report a locked folder as FolderLockedException
Fetching a locked folder before its password is sent returns 200 with only its listing fields, without metadata, sub_folders and path, so FoldersApi.retrieve failed with a pydantic ValidationError. The DOI route fetches the folder before it can see the lock, so a password-protected DOI folder could not be opened even with its password. - Add FolderLockedException, a subclass of UnauthorizedException, and raise it from retrieve on that short record and from the lock checks. - On a DOI folder, send the password and fetch it again when the first fetch finds it locked.
This commit is contained in:
@@ -28,6 +28,12 @@ class UnauthorizedException(MDRSException):
|
||||
pass
|
||||
|
||||
|
||||
class FolderLockedException(UnauthorizedException):
|
||||
"""Thrown when a folder cannot be opened without its password"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TokenExpiredException(UnauthorizedException):
|
||||
"""Thrown when the access token was still valid when sent but had expired on arrival"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user