Skip to content

Commit aeef806

Browse files
committed
Update FilesRouter.js
1 parent c2d4aac commit aeef806

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

src/Routers/FilesRouter.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -173,22 +173,13 @@ export class FilesRouter {
173173
const base64 = req.body.toString('base64');
174174
const file = new Parse.File(filename, { base64 }, contentType);
175175
const { metadata = {}, tags = {} } = req.fileData || {};
176-
if (req.config && req.config.requestKeywordDenylist) {
176+
try {
177177
// Scan request data for denied keywords
178-
for (const keyword of req.config.requestKeywordDenylist) {
179-
const match =
180-
Utils.objectContainsKeyValue(metadata, keyword.key, keyword.value) ||
181-
Utils.objectContainsKeyValue(tags, keyword.key, keyword.value);
182-
if (match) {
183-
next(
184-
new Parse.Error(
185-
Parse.Error.INVALID_KEY_NAME,
186-
`Prohibited keyword in request data: ${JSON.stringify(keyword)}.`
187-
)
188-
);
189-
return;
190-
}
191-
}
178+
Utils.checkProhibitedKeywords(config, metadata);
179+
Utils.checkProhibitedKeywords(config, tags);
180+
} catch (error) {
181+
next(new Parse.Error(Parse.Error.INVALID_KEY_NAME, error));
182+
return;
192183
}
193184
file.setTags(tags);
194185
file.setMetadata(metadata);

0 commit comments

Comments
 (0)