anchor.diff:          false -> throw({bad_request, <<"Attachment name is not UTF-8 encoded">>})
       end.
   
  --spec monitor_attachments(#att{} | [#att{}]) -> [reference()].
  -monitor_attachments(#att{}=Att) ->
  -    monitor_attachments([Att]);
  +-spec monitor_attachments(couch_att:att() | [couch_att:att()]) -> [reference()].
   monitor_attachments(Atts) when is_list(Atts) ->
  -    [monitor(process, Fd) || #att{data={Fd,_}} <- Atts].
  +    lists:map(fun(Att) ->
  +        {Fd, _} = couch_att:fetch(data, Att),
  +        monitor(process, Fd)
  +    end, Atts);
  +monitor_attachments(Att) ->
  +    monitor_attachments([Att]).
   
   demonitor_refs(Refs) when is_list(Refs) ->
       [demonitor(Ref) || Ref <- Refs].
  
positive.code:         'DELETE' ->
              [];
          _ ->
              [#att{
                  name=FileName,
                  type = case couch_httpd:header_value(Req,"Content-Type") of
                      undefined ->
                          % We could throw an error here or guess by the FileName.
                          % Currently, just giving it a default.
                          <<"application/octet-stream">>;
                      CType ->
                          list_to_binary(CType)
                      end,
                  data = fabric:att_receiver(Req, chttpd:body_length(Req)),
                  att_len = case couch_httpd:header_value(Req,"Content-Length") of
                      undefined ->
                          undefined;
                      Length ->
                          list_to_integer(Length)
                      end,
                  md5 = get_md5_header(Req),
                  encoding = case string:to_lower(string:strip(
                      couch_httpd:header_value(Req,"Content-Encoding","identity")
                  )) of
                  "identity" ->
                     identity;
                  "gzip" ->
                     gzip;
                  _ ->
                     throw({
                         bad_ctype,
                         "Only gzip and identity content-encodings are supported"
                     })
                  end
              }]
      end,
  
      Doc = case extract_header_rev(Req, couch_httpd:qs_value(Req, "rev")) of
  
negative.code:         end,
          AttFun = case ReqAcceptsAttEnc of
          false ->
              fun couch_att:foldl_decode/3;
          true ->
              fun couch_att:foldl/3
          end,
          chttpd:etag_respond(
              Req,
  