fix: fix upload path
This commit is contained in:
parent
9ad11b8f9e
commit
2d1ce37a59
@ -25,11 +25,11 @@ export async function uploadImage(userId: string, directory: string, prefix: str
|
|||||||
const processed = await processImage(src);
|
const processed = await processImage(src);
|
||||||
const key = randomKey(prefix);
|
const key = randomKey(prefix);
|
||||||
let filename = `${key}.${processed.format === 'png' ? 'png' : 'jpg'}`;
|
let filename = `${key}.${processed.format === 'png' ? 'png' : 'jpg'}`;
|
||||||
await s3client.putObject(s3bucket, directory + '/' + filename, src);
|
await s3client.putObject(s3bucket, 'public/users/' + userId + '/' + directory + '/' + filename, src);
|
||||||
await db.uploadedFile.create({
|
await db.uploadedFile.create({
|
||||||
data: {
|
data: {
|
||||||
accountId: userId,
|
accountId: userId,
|
||||||
path: `user/${userId}/${directory}/${filename}`,
|
path: `public/users/${userId}/${directory}/${filename}`,
|
||||||
reuseKey: 'image-url:' + url,
|
reuseKey: 'image-url:' + url,
|
||||||
width: processed.width,
|
width: processed.width,
|
||||||
height: processed.height,
|
height: processed.height,
|
||||||
@ -37,7 +37,7 @@ export async function uploadImage(userId: string, directory: string, prefix: str
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
path: `user/${userId}/${directory}/${filename}`,
|
path: `public/users/${userId}/${directory}/${filename}`,
|
||||||
thumbhash: processed.thumbhash,
|
thumbhash: processed.thumbhash,
|
||||||
width: processed.width,
|
width: processed.width,
|
||||||
height: processed.height
|
height: processed.height
|
||||||
|
Loading…
Reference in New Issue
Block a user