ring-clojure / ring-clojure/ring
Add :field to :store option in ring.middleware.multipart-params
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Clojure
- Stars
- 3.9k
- Forks
- 528
- PR merge metrics
- No merged PRs in 30d
Description
It would be nice to also have the field name passed to the :store function, like so:
(defn- parse-file-item
"Parse a FileItemStream into a key-value pair. If the request is a file the
supplied store function is used to save it."
[^FileItemStream item store encoding]
[(.getFieldName item)
(if (.isFormField item)
(Streams/asString (.openStream item) encoding)
(store {:filename (.getName item)
:field (.getFieldName item)
:content-type (.getContentType item)
:stream (.openStream item)}))])
This way different logic can be applied depending on the field.
Thanks
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
Locate the parse-file-item function in ring.middleware.multipart-params and read how its store callback is currently invoked. Update the behavior so the callback receives the field name as shown in the issue, then verify that field-specific storage logic works without changing ordinary form-field parsing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100