From 6e0871c4992feecead1c7cedae6e0bc160e62e48 Mon Sep 17 00:00:00 2001 From: Rossen Georgiev Date: Sun, 26 Apr 2020 17:48:50 +0100 Subject: [PATCH] CDNDepotFile: fix incorrect chunk location code --- steam/client/cdn.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/steam/client/cdn.py b/steam/client/cdn.py index 068f358b..f492c001 100644 --- a/steam/client/cdn.py +++ b/steam/client/cdn.py @@ -341,8 +341,12 @@ def read(self, length=-1): for chunk in self.chunks: if chunk.offset >= end_offset: break - elif (self.offset <= chunk.offset < end_offset - or self.offset < (chunk.offset + chunk.cb_original) <= end_offset): + + chunk_start = chunk.offset + chunk_end = chunk_start + chunk.cb_original + + if ( chunk_start <= self.offset < chunk_end + or chunk_start < end_offset <= chunk_end): if start_offset is None: start_offset = chunk.offset data.write(self._get_chunk(chunk)) @@ -677,7 +681,7 @@ def get_manifests(self, app_id, branch='public', password=None, filter_func=None is_enc_branch = False - if branch not in depots['branches']: + if branch not in depots.get('branches', {}): raise SteamError("No branch named %s for app_id %s" % (repr(branch), app_id)) elif int(depots['branches'][branch].get('pwdrequired', 0)) > 0: is_enc_branch = True