Closed itsalltoast closed 3 years ago
Makes sense and looks good, but I have to look into it a bit deeper. I think I had a reason to use pointers for that as I try to not use them if not necessary especially when it's part of an outer abstract layer.
Thank you for opening this PR. I did a bit or digging around and decided to take a different approach with #83 .
Reason (mostly described in the PR):
Fixing in createFile does not fix the issue under the hood and would fix only those two endpoints. We have only 2 endpoints with form data, but we can't guarantee we will not add new ones later. Other endpoint implementations are using pointers, therefore if someone jumps in and tries to implement a new one, but with MultipartRequest
, there is a high chance they will try to do it with pointers as all other endpoints are using pointers.
Having MultiPartRequest.Request passed in as a pointer caused a crash in core.parseMultipartFields() [core/multipart.go:18].
Removing the pointer and embedding the object directly fixes the crash.
Requirements for Contributing
Description of the Change
Un-pointerize a data field that is causing a client crash due to incorrect Go reflection.
Issue or RFC
Issue #81
Alternate Designs
It's possible to add more safety to the reflection in parseMultipartFields() as an alternative fix to this, but I'm not sure that would be better than just ensuring pointers are not passed in.
Possible Drawbacks
Increased stack memory usage.
Verification Process
Ran a test with and without this fix to confirm it corrects the crash.
Release Notes