mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 04:46:05 +00:00
fix s3 adapter
This commit is contained in:
@@ -124,7 +124,8 @@ export class AppMedia extends Module<typeof mediaConfigSchema> {
|
||||
async (e) => {
|
||||
const mutator = em.mutator(media);
|
||||
mutator.__unstable_toggleSystemEntityCreation(false);
|
||||
await mutator.insertOne(this.uploadedEventDataToMediaPayload(e.params));
|
||||
const payload = this.uploadedEventDataToMediaPayload(e.params);
|
||||
await mutator.insertOne(payload);
|
||||
mutator.__unstable_toggleSystemEntityCreation(true);
|
||||
console.log("App:storage:file uploaded", e);
|
||||
},
|
||||
|
||||
@@ -89,7 +89,8 @@ export class MediaController extends Controller {
|
||||
);
|
||||
}
|
||||
|
||||
return c.json(await this.getStorage().uploadFile(body, filename), HttpStatus.CREATED);
|
||||
const res = await this.getStorage().uploadFile(body, filename);
|
||||
return c.json(res, HttpStatus.CREATED);
|
||||
});
|
||||
|
||||
// add upload file to entity
|
||||
|
||||
@@ -80,7 +80,6 @@ export class Storage implements EmitsEvents {
|
||||
noEmit?: boolean
|
||||
): Promise<FileUploadedEventData> {
|
||||
const result = await this.#adapter.putObject(name, file);
|
||||
console.log("result", result);
|
||||
|
||||
let info: FileUploadPayload;
|
||||
|
||||
|
||||
@@ -122,18 +122,7 @@ export class StorageS3Adapter extends AwsClient implements StorageAdapter {
|
||||
|
||||
if (res.ok) {
|
||||
// "df20fcb574dba1446cf5ec997940492b"
|
||||
const etag = String(res.headers.get("etag"));
|
||||
if (isFile(body)) {
|
||||
return {
|
||||
etag,
|
||||
name: body.name,
|
||||
meta: {
|
||||
size: body.size,
|
||||
type: body.type
|
||||
}
|
||||
};
|
||||
}
|
||||
return etag;
|
||||
return String(res.headers.get("etag"));
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user