eiri commented on a change in pull request #785: Implement attachment size
limits
URL: https://github.com/apache/couchdb/pull/785#discussion_r136612196
##########
File path: src/couch/src/couch_doc.erl
##########
@@ -129,11 +129,24 @@ from_json_obj_validate(EJson) ->
Doc = from_json_obj(EJson),
case erlang:external_size(Doc#doc.body) =< MaxSize of
true ->
+ validate_attachment_sizes(Doc#doc.atts),
Doc;
false ->
throw({request_entity_too_large, Doc#doc.id})
end.
+
+validate_attachment_sizes([]) ->
+ ok;
+validate_attachment_sizes(Atts) ->
+ MaxAttSize = couch_att:max_attachment_size(),
+ [begin
Review comment:
why not `foreach`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services