From 3c6049ceeffba251c06b938737baed4d0a7b311d Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Sat, 13 May 2017 21:17:58 -0400 Subject: [PATCH] duplicate is probably less broken than it was --- server/controllers/aws.controller.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/controllers/aws.controller.js b/server/controllers/aws.controller.js index 5f252c45..ad6652ab 100644 --- a/server/controllers/aws.controller.js +++ b/server/controllers/aws.controller.js @@ -89,13 +89,14 @@ export function copyObjectInS3(req, res) { const objectKey = getObjectKey(url); const fileExtension = getExtension(objectKey); const newFilename = uuid.v4() + fileExtension; + const userId = req.user.id; const params = { Bucket: `${process.env.S3_BUCKET}`, CopySource: `${process.env.S3_BUCKET}/${objectKey}`, - Key: newFilename + Key: `${userId}/${newFilename}` }; const copy = client.copyObject(params); copy.on('end', () => { - res.json({ url: `${s3Bucket}${newFilename}` }); + res.json({ url: `${s3Bucket}${userId}/${newFilename}` }); }); }