You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by wo...@apache.org on 2017/06/06 21:31:21 UTC

[couchdb] branch 2.1.x updated: Fix encoding issues

This is an automated email from the ASF dual-hosted git repository.

wohali pushed a commit to branch 2.1.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/2.1.x by this push:
     new 76d2aee  Fix encoding issues
76d2aee is described below

commit 76d2aee176d4dfc6d8d55fa1dc47d2927cea70c1
Author: ILYA Khlopotov <ii...@apache.org>
AuthorDate: Thu Jun 1 09:56:35 2017 -0700

    Fix encoding issues
    
    This fixes encoding issues in responses on following requests:
    
     - PUT: {db}/{design}/_update/{update}/{doc_id}
     - PUT: {db}/{doc_id}/{att_id}
---
 src/chttpd/src/chttpd_db.erl               | 2 +-
 src/chttpd/src/chttpd_show.erl             | 2 +-
 src/couch_mrview/src/couch_mrview_show.erl | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl
index 902b5b9..a7796fc 100644
--- a/src/chttpd/src/chttpd_db.erl
+++ b/src/chttpd/src/chttpd_db.erl
@@ -1269,7 +1269,7 @@ db_attachment_req(#httpd{method=Method, user_ctx=Ctx}=Req, Db, DocId, FileNamePa
             {200, []};
         _ ->
             {HttpCode, [{"Location", absolute_uri(Req, [$/, DbName, $/, couch_util:url_encode(DocId), $/,
-                FileName])}]}
+                couch_util:url_encode(FileName)])}]}
         end,
     send_json(Req,Status, Headers, {[
         {ok, true},
diff --git a/src/chttpd/src/chttpd_show.erl b/src/chttpd/src/chttpd_show.erl
index 49fed7b..63381ca 100644
--- a/src/chttpd/src/chttpd_show.erl
+++ b/src/chttpd/src/chttpd_show.erl
@@ -141,7 +141,7 @@ send_doc_update_response(Req, Db, DDoc, UpdateName, Doc, DocId) ->
             end,
             {JsonResp1} = apply_headers(JsonResp0, [
                 {<<"X-Couch-Update-NewRev">>, NewRevStr},
-                {<<"X-Couch-Id">>, NewDoc#doc.id}
+                {<<"X-Couch-Id">>, couch_util:url_encode(NewDoc#doc.id)}
             ]),
             {[{<<"code">>, Code} | JsonResp1]};
         [<<"up">>, _Other, {JsonResp0}] ->
diff --git a/src/couch_mrview/src/couch_mrview_show.erl b/src/couch_mrview/src/couch_mrview_show.erl
index 1ebc85b..3a602ad 100644
--- a/src/couch_mrview/src/couch_mrview_show.erl
+++ b/src/couch_mrview/src/couch_mrview_show.erl
@@ -138,7 +138,7 @@ send_doc_update_response(Req, Db, DDoc, UpdateName, Doc, DocId) ->
             NewRevStr = couch_doc:rev_to_str(NewRev),
             {JsonResp1} = apply_headers(JsonResp0, [
                 {<<"X-Couch-Update-NewRev">>, NewRevStr},
-                {<<"X-Couch-Id">>, NewDoc#doc.id}
+                {<<"X-Couch-Id">>, couch_util:url_encode(NewDoc#doc.id)}
             ]),
             {[{<<"code">>, 201} | JsonResp1]};
         [<<"up">>, _Other, {JsonResp0}] ->

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <co...@couchdb.apache.org>'].