parse-community / parse-community/parse-server
Add request information to FilesAdapter to be able to store files based in request info (like IP address)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
Hi,
we are using S3 adapter for storing our files. Because of our app stores user's data (not public one), we wanted to store data to servers, that are close to users. It means EU users on EU servers, US users on US servers and so on. It also helps us to be GDPR complaint.
We tried to write our custom FIlesAdapter based on existing S3 adapter, but we realised, that it is not possible to get request information in FilesAdapter - we wanted to use client IP address to resolve location through GeoIP.
The proposal
I looked, that this should be relatively easy to inject additional data to FilesAdapter - in FilesRouter's createFile function we can send additional data to filesController. The FilesAdapter interface then can be extended by adding request parameter to createFile function.
Yes, this is breaking change, so that another option is to use options parameter in createFile method, that is already here.
Options considered
We were thinking about creating cloudCode function, that will emulate ParseFile functionality - it will get fileName and byte[] data and then store it. However, I am not sure, if it will not have impact on performance - doest Parse File has some special handing for large files upload or so? We will also lost functionality that Parse File provides and break code in our app, that is currently using Parse File.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Trace the upload path from FilesRouter's createFile through filesController and the FilesAdapter interface, comparing it with the existing S3 adapter. Review how the current options parameter is passed and identify the request information available at that point. Done means the adapter contract and relevant upload flow support the requested request context without losing existing ParseFile behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100