diff --git a/Changes.txt b/Changes.txt index 765bedee8..689c219d8 100644 --- a/Changes.txt +++ b/Changes.txt @@ -11,6 +11,8 @@ `umount.s3ql`, `umount`, or `fusermount -u` and wait for the mount.s3ql process to terminate. + * More robust expired auth token detection for Google Storage. + 2020-11-09, S3QL 3.6.0 diff --git a/src/s3ql/backends/gs.py b/src/s3ql/backends/gs.py index 730c16a78..10167eb1b 100644 --- a/src/s3ql/backends/gs.py +++ b/src/s3ql/backends/gs.py @@ -436,12 +436,11 @@ def write_fh(self, fh, key: str, md5: bytes, raise ValueError('md5 passed to write_fd does not match fd data') resp = self.conn.read_response() - if resp.status != 200: + # If we're really unlucky, then the token has expired while we were uploading data. + if resp.status == 401: + raise AccessTokenExpired() + elif resp.status != 200: exc = self._parse_error_response(resp) - # If we're really unlucky, then the token has expired while we - # were uploading data. - if exc.message == 'Invalid Credentials': - raise AccessTokenExpired() raise _map_request_error(exc, key) or exc self._parse_json_response(resp)