Skip to content

Commit 8fcaf81

Browse files
committed
fixed exception in case of file not found
1 parent 8429e0e commit 8fcaf81

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cs3client/file.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ def write_file(
226226
else:
227227
headers = {
228228
"Upload-Length": str(size),
229+
"Content-Length": str(size),
229230
"X-Reva-Transfer": protocol.token,
230231
**dict([auth_token]),
231232
"X-Lock-Id": lock_id,
@@ -318,7 +319,10 @@ def read_file(self, auth_token: tuple, resource: Resource, lock_id: Optional[str
318319
f'msg="Error downloading file from Reva" code="{fileget.status_code}" '
319320
f'reason="{status_msg}"'
320321
)
321-
raise IOError(fileget.reason)
322+
if fileget.status_code == http.client.NOTFOUND:
323+
raise NotFoundException()
324+
else:
325+
raise IOError(fileget.reason)
322326
else:
323327
self._log.info(
324328
f'msg="File open for read" {resource.get_file_ref_str()} elapsedTimems="{(tend - tstart) * 1000:.1f}"'

0 commit comments

Comments
 (0)