From 53ea31008a65add2abc37278c64a6552962bd3b8 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 2 May 2023 08:17:46 +0200 Subject: [PATCH] fix: download the repository if the file is cached --- src/source/GitHubDownload.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/source/GitHubDownload.ts b/src/source/GitHubDownload.ts index 4bf8904..58866a2 100644 --- a/src/source/GitHubDownload.ts +++ b/src/source/GitHubDownload.ts @@ -135,10 +135,12 @@ export default class GitHubDownload extends GitHubBase implements SourceBase { if (await storage.exists(file.originalCachePath)) { return storage.read(file.originalCachePath); } - throw new AnonymousError("file_not_found", { - httpStatus: 404, - object: file, - }); + // will throw an error if the file is not in the repository + await file.originalPath(); + + // the cache is not ready, we need to download the repository + await this.download(); + return storage.read(file.originalCachePath); } async getFiles() {