couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject couchdb commit: updated refs/heads/1.x.x to 428b5ad
Date Tue, 28 Apr 2015 12:59:54 GMT
Repository: couchdb
Updated Branches:
  refs/heads/1.x.x 6e0202cc7 -> 428b5ad7b


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/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/428b5ad7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/428b5ad7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/428b5ad7

Branch: refs/heads/1.x.x
Commit: 428b5ad7b4295964b09196c224a39c094632a731
Parents: 6e0202c
Author: Samuel Tardieu <sam@rfc1149.net>
Authored: Sun Apr 26 00:10:04 2015 +0200
Committer: Samuel Tardieu <sam@rfc1149.net>
Committed: Tue Apr 28 14:57:30 2015 +0200

----------------------------------------------------------------------
 src/couchdb/couch_httpd_db.erl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/428b5ad7/src/couchdb/couch_httpd_db.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index 5691007..9f77a80 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -716,7 +716,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) ++ "/" ++ ?b2l(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, []).
@@ -1014,9 +1014,9 @@ db_attachment_req(#httpd{method=Method,mochi_req=MochiReq}=Req, Db,
DocId, FileN
         [];
     _ ->
         [{"Location", absolute_uri(Req, "/" ++
-            ?b2l(Db#db.name) ++ "/" ++
-            ?b2l(DocId) ++ "/" ++
-            ?b2l(FileName)
+            couch_util:url_encode(Db#db.name) ++ "/" ++
+            couch_util:url_encode(DocId) ++ "/" ++
+            couch_util:url_encode(FileName)
         )}]
     end,
     update_doc(Req, Db, DocId, DocEdited, Headers);


Mime
View raw message