anchor.diff:  
       #doc{atts=Atts} = Doc,
       DocEdited = Doc#doc{
  -        atts = NewAtt ++ [A || A <- Atts, A#att.name /= FileName]
  +        atts = NewAtt ++ [A || A <- Atts, couch_att:fetch(name, A) /= FileName]
       },
       case fabric:update_doc(Db, DocEdited, [{user_ctx,Ctx}]) of
       {ok, UpdatedRev} ->
  
positive.code:                             Headers1 = [{<<"Content-Range">>, make_content_range(From, To, Len)}]
                                  ++ Headers,
                              {ok, Resp} = start_response_length(Req, 206, Headers1, To - From + 1),
                              couch_doc:range_att_foldl(Att, From, To + 1,
                                  fun(Seg, _) -> send(Resp, Seg) end, {ok, Resp});
                          {identity, Ranges} when is_list(Ranges) andalso length(Ranges) < 10 ->
                              send_ranges_multipart(Req, Type, Len, Att, Ranges);
                          _ ->
                              Headers1 = Headers ++
                                  if Enc =:= identity orelse ReqAcceptsAttEnc =:= true ->
                                      [{"Content-MD5", base64:encode(Att#att.md5)}];
                                  true ->
                                      []
                              end,
  
negative.code:         'DELETE' ->
              [];
          _ ->
              MimeType = case couch_httpd:header_value(Req,"Content-Type") of
                  % We could throw an error here or guess by the FileName.
                  % Currently, just giving it a default.
                  undefined -> <<"application/octet-stream">>;
                  CType -> list_to_binary(CType)
              end,
              Data = fabric:att_receiver(Req, chttpd:body_length(Req)),
              ContentLen = case couch_httpd:header_value(Req,"Content-Length") of
                  undefined -> undefined;
                  Length -> list_to_integer(Length)
              end,
              ContentEnc = string:to_lower(string:strip(
                  couch_httpd:header_value(Req, "Content-Encoding", "identity")
              )),
              Encoding = case ContentEnc of
                  "identity" ->
                      identity;
                  "gzip" ->
                      gzip;
                  _ ->
                      throw({
                          bad_ctype,
                          "Only gzip and identity content-encodings are supported"
                      })
              end,
              [couch_att:new([
                  {name, FileName},
                  {type, MimeType},
                  {data, Data},
                  {att_len, ContentLen},
                  {md5, get_md5_header(Req)},
                  {encoding, Encoding}
              ])]
      end,
  
      Doc = case extract_header_rev(Req, couch_httpd:qs_value(Req, "rev")) of
  