Skip to content

Commit dd3e356

Browse files
authored
xavia-io/xavia-ota | feat | GCS Support Final Update (#14)
* feat: support gcs * feat: update readme * feat: update documentation and warning * feat: updating for GCS filename structure * feat: github suggestion breakline * feat: fixing xavia fileExists
1 parent ff985ee commit dd3e356

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

apiUtils/storage/GCSStorage.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,13 @@ export class GCSStorage implements StorageInterface {
5858

5959
async fileExists(path: string): Promise<boolean> {
6060
const [files] = await this.storage.bucket(this.bucketName).getFiles({
61-
prefix: path.split('/').slice(0, -1).join('/'),
61+
prefix: path,
6262
});
6363

64-
return files.some((file: any) => file.name.split('/').pop() === path.split('/').pop());
64+
const pathParts = path.split('/');
65+
const requestedFile = pathParts[pathParts.length - 1];
66+
67+
return files.some((file: any) => file.name.includes(requestedFile));
6568
}
6669

6770
async listFiles(directory: string): Promise<

0 commit comments

Comments
 (0)