incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <...@apache.org>
Subject Posting empty attachments
Date Wed, 16 Jul 2008 23:52:11 GMT
Heya Damien,
the recently added RESTful API for attachments still lacks
support for empty attachments. CouchDB will fail in
the couch_db:doc_flush_binaries/2 function. The following
patch makes my (new) testcase of writing and reading an
empty attachment work, but I am sure it is not completely
correct. Also, I am not yet entirely sure if that is the right
place to fix that. Any pointers appreciated :)


Cheers
Jan
--
Index: /Users/jan/Work/couchdb-all/trunk/src/couchdb/couch_db.erl
===================================================================
--- /Users/jan/Work/couchdb-all/trunk/src/couchdb/couch_db.erl	 
(revision 675780)
+++ /Users/jan/Work/couchdb-all/trunk/src/couchdb/couch_db.erl	 
(working copy)
@@ -348,6 +348,9 @@
          fun({Key, {Type, BinValue}}) ->
              NewBinValue =
              case BinValue of
+            <<>> ->
+                % empty attachment
+                {0, 0, 0};
              {Fd0, StreamPointer, Len} when Fd0 == Fd ->
                  % already written to our file, nothing to write
                  {Fd, StreamPointer, Len};


Mime
View raw message