|
44 | 44 | (getCharacterEncoding [_] encoding)
|
45 | 45 | (getInputStream [_] (:body request))))
|
46 | 46 |
|
47 |
| -(defn- file-item-iterator-seq [^FileItemIterator it] |
48 |
| - (lazy-seq |
49 |
| - (when (.hasNext it) |
50 |
| - (cons (.next it) (file-item-iterator-seq it))))) |
51 |
| - |
52 |
| -(defn- file-item-seq [^FileUpload upload context] |
53 |
| - (file-item-iterator-seq (.getItemIterator upload context))) |
| 47 | +(defn- file-item-iterable [^FileUpload upload context] |
| 48 | + (reify Iterable |
| 49 | + (iterator [_] |
| 50 | + (let [it (.getItemIterator upload context)] |
| 51 | + (reify java.util.Iterator |
| 52 | + (hasNext [_] (.hasNext it)) |
| 53 | + (next [_] (.next it))))))) |
54 | 54 |
|
55 | 55 | (defn- parse-content-type-charset [^FileItemStream item]
|
56 | 56 | (some->> (.getContentType item) parsing/find-content-type-charset))
|
|
96 | 96 | (req/character-encoding request)
|
97 | 97 | "UTF-8")]
|
98 | 98 | (->> (request-context request fallback-encoding)
|
99 |
| - (file-item-seq (file-upload request options)) |
100 |
| - (map-indexed (fn [i item] |
101 |
| - (if (and max-file-count (>= i max-file-count)) |
102 |
| - (throw (ex-info "Max file count exceeded" |
103 |
| - {:max-file-count max-file-count})) |
104 |
| - (parse-file-item item store)))) |
| 99 | + (file-item-iterable (file-upload request options)) |
| 100 | + (sequence |
| 101 | + (map-indexed (fn [i item] |
| 102 | + (if (and max-file-count (>= i max-file-count)) |
| 103 | + (throw (ex-info "Max file count exceeded" |
| 104 | + {:max-file-count max-file-count})) |
| 105 | + (parse-file-item item store))))) |
105 | 106 | (build-param-map encoding fallback-encoding))))
|
106 | 107 |
|
107 | 108 | (defn multipart-params-request
|
|
0 commit comments