The attached patch does two things:
* :filename option takes precedence of automatically determined names
 (it was the case previously only for pathnames, and not for streams or 
functions).
* if stream is a file-stream, which means it's a pathname designator,
use file-namestring to get the filename.
--- old-drakma/request.lisp	2010-12-26 16:45:30.356179246 +0300
+++ new-drakma/request.lisp	2010-12-26 16:45:30.356179246 +0300
@@ -112,10 +112,13 @@
                       (first value)
                       (not (stringp (first value))))
                  (let* ((file-source (first value))
-                        (filename (or (if (functionp file-source) "user-closure")
-                                      (if (streamp file-source) "user-stream")
-                                      (getf (rest value) :filename)
-                                      (file-namestring file-source)))
+                        (filename (or (getf (rest value) :filename)
+                                      (etypecase file-source
+                                        (function "user-closure")
+                                        (file-stream (or (file-namestring file-source)
+                                                         "user-stream"))
+                                        (stream "user-stream")
+                                        (pathname (file-namestring file-source)))))
                         (content-type (or (getf (rest value) :content-type)
                                           "application/octet-stream")))
                    (format stream "; filename=\"~A\"" filename)
-- 
With Best Regards, Stas.
_______________________________________________
drakma-devel mailing list
drakma-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel

Reply via email to