Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fu351 committed Dec 15, 2023
1 parent 5e5c36a commit 4da4a35
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions upload_update_download_rate.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ router.post('/package', upload.single('file'), async (req, res) => { //upload pa
URL: homepage,
Name: packageName,
Version: zip_ver.toString(),
ID: packageID
ID: packageID,
Popularity: scores[9],
}
};

Expand Down Expand Up @@ -344,15 +345,14 @@ router.put('/package/:id', async (req, res) => { //update package
return res.status(400).json({error: 'The package ID does not match the ID in the URL'});
}


let existingMetaData;
//Next check that name, version, and ID match
try {
const existingPackageParams = {
Bucket: '461testbucket',
Key: `packages/${ID}.zip`,
};

let existingMetaData;
const existingPackage = await s3.headObject(existingPackageParams).promise();
if (!existingPackage) {
return res.status(404).json({ error: 'Package does not exist' });
Expand Down Expand Up @@ -418,7 +418,8 @@ router.put('/package/:id', async (req, res) => { //update package
URL: URL,
Name: Name,
Version: Version,
ID: ID
ID: ID,
Popularity: existingMetaData.popularity,
}
};

Expand Down

0 comments on commit 4da4a35

Please sign in to comment.