jiangphcn commented on a change in pull request #1072: Decode destination
header for doc copy
URL: https://github.com/apache/couchdb/pull/1072#discussion_r158033585
##########
File path: src/chttpd/src/chttpd_db.erl
##########
@@ -825,7 +825,8 @@ db_doc_req(#httpd{method='COPY', user_ctx=Ctx}=Req, Db,
SourceDocId) ->
missing_rev -> nil;
Rev -> Rev
end,
- {TargetDocId, TargetRevs} =
couch_httpd_db:parse_copy_destination_header(Req),
+ {TargetDocId0, TargetRevs} =
couch_httpd_db:parse_copy_destination_header(Req),
+ TargetDocId = list_to_binary(mochiweb_util:unquote(TargetDocId0)),
Review comment:
Thanks, Bob. According to statement from Garren in issue #977
```
Which means the API works although it doesn't follow 100% the Destination
header's spec which states the header should contain an URI, hence its value
should be encoded if it includes characters outside the valid range.
```
If spec implies that destination header for couchdb should be encoded, we
need to decode here. If there is no escaped character in docid for target doc,
calling `mochiweb_util:unquote/1` will not change the content of docid.
----------------------------------------------------------------
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