diff --git a/v1/src/apps/private/load-attachments/services.js b/v1/src/apps/private/load-attachments/services.js index c2af134..2792019 100644 --- a/v1/src/apps/private/load-attachments/services.js +++ b/v1/src/apps/private/load-attachments/services.js @@ -118,7 +118,7 @@ async function createLoadAttachment( type , userId , loadId ){ const postLoadingAttachment = async(req, res) => { const loadId = req.params.id; const attachment = await createLoadAttachment( "Loading", req.JWT.payload.sub , loadId ); - const file = req.files.attachment; + const file = req.files?.attachment; if( attachment && file ){ await uploadFile( s3Bucket, s3BucketKey, attachment._id, file ); res.send( attachment ); @@ -132,7 +132,7 @@ const postLoadingAttachment = async(req, res) => { const postDownloadingAttachment = async(req, res) => { const loadId = req.params.id; const attachment = await createLoadAttachment( "Downloading", req.JWT.payload.sub , loadId ); - const file = req.files.attachment; + const file = req.files?.attachment; if( attachment && file ){ await uploadFile( s3Bucket, s3BucketKey, attachment._id, file ); res.send( attachment );