-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid non-blob webresources fields on multipart requests #746
base: master
Are you sure you want to change the base?
Conversation
@@ -151,7 +157,9 @@ export const getUploaderMiddlware = ( | |||
completeUploads.push( | |||
(async () => { | |||
try { | |||
if (!(await isFileInValidPath(fieldname, req))) { | |||
if ( | |||
!(await isFileInValidPath(fieldname, req, parsedOdataRequest)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a later improvement there's a lot of work done in isFileInValidPath
that would be nice to avoid duplicating if there are multiple uploads in a single request. I don't know if the duplication is avoidable but I suspect so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in my todo list for webresources
@@ -67,6 +67,7 @@ export const getWebresourceHandler = (): WebResourceHandler | undefined => { | |||
const isFileInValidPath = async ( | |||
fieldname: string, | |||
req: Express.Request, | |||
odataRequest: uriParser.ParsedODataRequest, | |||
): Promise<boolean> => { | |||
if (req.method !== 'POST' && req.method !== 'PATCH') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we allow multipart requests on requests that aren't POST/PATCH?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Page- We don't do anything, basically. Whatever is the content of multpart/body in those requests is just dropped. IMHO it is the expected behaviour as it is the same thing of a GET request with a body (it works, but the body is just ignored as it should not be there).
08b91f1
to
be666fc
Compare
a5f6022
to
abb6980
Compare
Change-type: patch
abb6980
to
a7dfa37
Compare
Change-type: patch