You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/08/07 19:35:06 UTC

couch commit: updated refs/heads/windsor-merge to 53faa74

Repository: couchdb-couch
Updated Branches:
  refs/heads/windsor-merge 71335c8d5 -> 53faa743d


[WIP] Fix decompression of attachment info


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/53faa743
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/53faa743
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/53faa743

Branch: refs/heads/windsor-merge
Commit: 53faa743d62a06e6279a4fa87b4b9723f3810303
Parents: 71335c8
Author: Paul J. Davis <pa...@gmail.com>
Authored: Thu Aug 7 12:34:44 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Thu Aug 7 12:34:44 2014 -0500

----------------------------------------------------------------------
 src/couch_db.erl | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/53faa743/src/couch_db.erl
----------------------------------------------------------------------
diff --git a/src/couch_db.erl b/src/couch_db.erl
index baaed37..8a9f9e4 100644
--- a/src/couch_db.erl
+++ b/src/couch_db.erl
@@ -1304,7 +1304,18 @@ make_doc(_Db, Id, Deleted, nil = _Bp, RevisionPath) ->
         deleted = Deleted
     };
 make_doc(#db{fd=Fd}=Db, Id, Deleted, Bp, RevisionPath) ->
-    {ok, {BodyData, Atts0}} = read_doc(Db, Bp),
+    {BodyData, Atts0} = case Bp of
+        nil ->
+            {[], []};
+        _ ->
+            case read_doc(Db, Bp) of
+                {ok, {BodyData0, Atts1}} when is_binary(Atts1) ->
+                    {BodyData0, couch_compress:decompress(Atts1)};
+                {ok, {BodyData0, Atts1}} when is_list(Atts1) ->
+                    % pre 1.2 format
+                    {BodyData0, Atts1}
+            end
+    end,
     Atts = [couch_att:from_disk_term(Fd, T) || T <- Atts0],
     Doc = #doc{
         id = Id,