Local file storage (#5763)
Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
@@ -90,7 +90,7 @@ export default abstract class ExportTask extends BaseTask<Props> {
|
||||
});
|
||||
|
||||
const stat = await fs.promises.stat(filePath);
|
||||
const url = await FileStorage.upload({
|
||||
const url = await FileStorage.store({
|
||||
body: fs.createReadStream(filePath),
|
||||
contentLength: stat.size,
|
||||
contentType: "application/zip",
|
||||
|
||||
@@ -20,14 +20,14 @@ export default class UploadTeamAvatarTask extends BaseTask<Props> {
|
||||
rejectOnEmpty: true,
|
||||
});
|
||||
|
||||
const res = await FileStorage.uploadFromUrl(
|
||||
const res = await FileStorage.storeFromUrl(
|
||||
props.avatarUrl,
|
||||
`avatars/${team.id}/${uuidv4()}`,
|
||||
"public-read"
|
||||
);
|
||||
|
||||
if (res?.url) {
|
||||
await team.update({ avatarUrl: res?.url });
|
||||
await team.update({ avatarUrl: res.url });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,14 +20,14 @@ export default class UploadUserAvatarTask extends BaseTask<Props> {
|
||||
rejectOnEmpty: true,
|
||||
});
|
||||
|
||||
const res = await FileStorage.uploadFromUrl(
|
||||
const res = await FileStorage.storeFromUrl(
|
||||
props.avatarUrl,
|
||||
`avatars/${user.id}/${uuidv4()}`,
|
||||
"public-read"
|
||||
);
|
||||
|
||||
if (res?.url) {
|
||||
await user.update({ avatarUrl: res?.url });
|
||||
await user.update({ avatarUrl: res.url });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user