Skip to content

Commit cf965b4

Browse files
committed
Add Default Config Options
1 parent d07525e commit cf965b4

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/firebase.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,20 @@ export default class FirebaseStorageAdapter extends BaseAdapter {
3333
return filesExists[0];
3434
}
3535

36+
async save(image: Image): Promise<string> {
3637
const targetDirectory = this.getTargetDir(this.basePath);
3738
// the typings are wrong here, getUniqueFileName returns a promise of a string
3839
const pathToSave = await this.getUniqueFileName(image, targetDirectory);
39-
return this.bucket
40-
.upload(image.path, {
41-
...(this.uploadOptions ? { ...this.uploadOptions } : {}),
40+
const defaultUploadOptions = {
41+
metadata: {
42+
cacheControl: `public, max-age=${30000}`,
43+
},
44+
public: true,
45+
};
46+
const uploadOptions = {
47+
...(this.uploadOptions ? this.uploadOptions : defaultUploadOptions),
4248
destination: pathToSave.split(sep).join(posix.sep),
43-
})
44-
.then(() => pathToSave);
49+
};
4550
}
4651

4752
serve() {

0 commit comments

Comments
 (0)