Skip to content

Commit e3556a1

Browse files
authored
Merge fb564e7 into b7b38c3
2 parents b7b38c3 + fb564e7 commit e3556a1

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

source/_addonStore/dataManager.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,21 @@ def _cacheLatestAddons(self, addonData: str, cacheHash: str):
153153
def _getCachedAddonData(self, cacheFilePath: str) -> Optional[CachedAddonsModel]:
154154
if not os.path.exists(cacheFilePath):
155155
return None
156-
with open(cacheFilePath, 'r') as cacheFile:
157-
try:
156+
try:
157+
with open(cacheFilePath, 'r') as cacheFile:
158158
cacheData = json.load(cacheFile)
159-
except Exception:
160-
log.exception(f"Invalid add-on store cache")
161-
return None
159+
except Exception:
160+
log.exception(f"Invalid add-on store cache")
161+
os.remove(cacheFilePath)
162+
return None
162163
try:
163164
data = cacheData["data"]
164165
cacheHash = cacheData["cacheHash"]
165166
cachedLanguage = cacheData["cachedLanguage"]
166167
nvdaAPIVersion = cacheData["nvdaAPIVersion"]
167168
except KeyError:
168169
log.exception(f"Invalid add-on store cache:\n{cacheData}")
170+
os.remove(cacheFilePath)
169171
return None
170172
return CachedAddonsModel(
171173
cachedAddonData=_createStoreCollectionFromJson(data),

0 commit comments

Comments
 (0)