You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2015/10/01 15:48:44 UTC

couch commit: updated refs/heads/master to 9ffa160

Repository: couchdb-couch
Updated Branches:
  refs/heads/master d405523c3 -> 9ffa1607b


Properly escape Location: HTTP header

Non-ASCII characters in the "Location:" header must be URL-encoded. This
can happen if a document is inserted with a user-defined "_id"
containing non-ASCII characters or if a filename contains non-ASCII
characters.

Fixes COUCHDB-2673


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/9ffa1607
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/9ffa1607
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/9ffa1607

Branch: refs/heads/master
Commit: 9ffa1607bce778cc26dccf08a7739fa6d61a5fee
Parents: d405523
Author: Samuel Tardieu <sa...@rfc1149.net>
Authored: Sun Apr 26 00:10:04 2015 +0200
Committer: Robert Newson <rn...@apache.org>
Committed: Thu Oct 1 14:48:15 2015 +0100

----------------------------------------------------------------------
 src/couch_httpd_db.erl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/9ffa1607/src/couch_httpd_db.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd_db.erl b/src/couch_httpd_db.erl
index f2a5c14..db14f75 100644
--- a/src/couch_httpd_db.erl
+++ b/src/couch_httpd_db.erl
@@ -730,7 +730,7 @@ update_doc_result_to_json(DocId, Error) ->
 
 
 update_doc(Req, Db, DocId, #doc{deleted=false}=Doc) ->
-    Loc = absolute_uri(Req, "/" ++ ?b2l(Db#db.name) ++ "/" ++ couch_util:url_encode(DocId)),
+    Loc = absolute_uri(Req, "/" ++ couch_util:url_encode(Db#db.name) ++ "/" ++ couch_util:url_encode(DocId)),
     update_doc(Req, Db, DocId, Doc, [{"Location", Loc}]);
 update_doc(Req, Db, DocId, Doc) ->
     update_doc(Req, Db, DocId, Doc, []).
@@ -1030,9 +1030,9 @@ db_attachment_req(#httpd{method=Method,mochi_req=MochiReq}=Req, Db, DocId, FileN
         [];
     _ ->
         [{"Location", absolute_uri(Req, "/" ++
-            ?b2l(Db#db.name) ++ "/" ++
+            couch_util:url_encode(Db#db.name) ++ "/" ++
             couch_util:url_encode(DocId) ++ "/" ++
-            ?b2l(FileName)
+            couch_util:url_encode(FileName)
         )}]
     end,
     update_doc(Req, Db, DocId, DocEdited, Headers);