couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject couch commit: updated refs/heads/windsor-merge to 53faa74
Date Thu, 07 Aug 2014 17:35:06 GMT
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 <paul.joseph.davis@gmail.com>
Authored: Thu Aug 7 12:34:44 2014 -0500
Committer: Paul J. Davis <paul.joseph.davis@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,


Mime
View raw message