Skip to content

Commit

Permalink
add allowed keys in generateFileInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
AmelieLoulergue committed Jan 9, 2025
1 parent dc08a1a commit 1e29633
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/api/middleware/validators/oneFileValidators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const validatorFileSize = async (req: Request, res: Response, next: NextF
};

export const generateFileInfo = (body, method = 'PATCH') => {
const keysAllowed = ['external_id', 'expired', 'expiration_date', 'information', ...(method === 'POST' ? ['destination'] : [])];
const keysAllowed = ['external_id', 'expired', 'expiration_date', 'information', 'signature', 'namespace', 'size', 'base_host', 'base_url', ...(method === 'POST' ? ['destination'] : [])];
const bodyKeys = Object.keys(body.changes ?? body);
const hasAllowedKey = bodyKeys.some((key) => keysAllowed.includes(key));
if (hasAllowedKey) {
Expand Down
20 changes: 12 additions & 8 deletions src/api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.17.1",
"express": "4.21.2",
"express-rate-limit": "^7.1.5",
"form-data": "^4.0.1",
"joi": "^17.13.3",
Expand Down

0 comments on commit 1e29633

Please sign in to comment.