Re: [drakma-devel] [Patch]: better file-names when sending multipart/form-data from streams.

2011-01-21 Thread Edi Weitz
Thanks, in the repository now.

On Sun, Dec 26, 2010 at 3:01 PM, Stas Boukarev stass...@gmail.com wrote:
 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.


 --
 With Best Regards, Stas.

 ___
 drakma-devel mailing list
 drakma-devel@common-lisp.net
 http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel



___
drakma-devel mailing list
drakma-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel


[drakma-devel] [Patch]: better file-names when sending multipart/form-data from streams.

2010-12-26 Thread Stas Boukarev
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