   DateTime
   (to-json [t, ^JsonGenerator jg] (.writeString jg (str t))))
 
-(defn- translate-file-from-stream [reader, dataset, mapping, validity, json-filename-fn]
+(defn- translate-file-from-stream [reader, dataset, mapping, validity, original-filename]
   "Read from reader, xml2json translate the content"
   (let [compressed-files (volatile! [])]
     (runner/translate

  "Transforms a file or zip-stream and returns a vector with the transformed files"
  (if (= format :zip)
    (translate-from-zipfile file dataset mapping validity)
    (let [json-filename-fn #(let [json-filename (fs/json-filename original-filename)]
                              (log/debug "Saving result as" json-filename)
                              json-filename)]
      (log/debug "Going to transform file" original-filename)
      (with-open [stream (condp = format
                           :gzip (GZIPInputStream. (FileInputStream. file))
                           :plain (FileInputStream. file))]
        (translate-file-from-stream stream dataset mapping validity json-filename-fn)))))

(defn extract-filename [headers, ^String uri]
  "Extract the original filename from the Content-Disposition header, or from the URI if unavailable"

      validity
      reader
      #(doseq [file %]
         (let [json-filename ^String (fs/json-filename original-filename)
               compressed-file (fs/create-target-file json-filename)]
           (log/debug "Saving result as" json-filename)
           (with-open [output-stream (io/output-stream compressed-file)
                       zip (ZipOutputStream. output-stream)]
             (.putNextEntry zip (ZipEntry. json-filename))
