You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2021/07/15 17:28:56 UTC

[GitHub] [couchdb] noahshaw11 commented on a change in pull request #3667: Fix response code for nonexistent attachment

noahshaw11 commented on a change in pull request #3667:
URL: https://github.com/apache/couchdb/pull/3667#discussion_r670671799



##########
File path: src/chttpd/src/chttpd_db.erl
##########
@@ -1819,6 +1819,21 @@ db_attachment_req(#httpd{method = Method} = Req, Db, DocId, FileNameParts) when
         )
     ),
 
+    % Check if attachment exists
+    #doc_query_args{
+        rev=Rev,
+        options=Options
+    } = parse_doc_query(Req),
+    #doc{
+        atts=Atts
+    } = Doc = couch_doc_open(Db, DocId, Rev, Options),
+    case [A || A <- Atts, couch_att:fetch(name, A) == FileName] of
+        [] ->
+            throw({not_found, "Document is missing attachment"});

Review comment:
       Fixed in https://github.com/apache/couchdb/pull/3667/commits/7190c7eb72ba4bdcb6112efa9aabe2436e094528.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org