couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject chttpd commit: updated refs/heads/master to b44515f
Date Thu, 30 Oct 2014 14:26:20 GMT
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master 57b87ce94 -> b44515f1c


Fix location-header for documents with newlines in the name

Properly urlencode the Document-Id in the Location-field of the
header

Based on a patch from Sean Bartell <wingedtachikoma@gmail.com>
COUCHDB-708


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

Branch: refs/heads/master
Commit: b44515f1c137994f5278f42106ecf720e2c35011
Parents: 57b87ce
Author: Robert Kowalski <rok@kowalski.gd>
Authored: Sat Oct 25 04:45:07 2014 +0200
Committer: Robert Kowalski <rok@kowalski.gd>
Committed: Sat Oct 25 15:31:22 2014 +0200

----------------------------------------------------------------------
 src/chttpd_db.erl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/b44515f1/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index cf5f1fa..24eb78c 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -669,7 +669,7 @@ db_doc_req(#httpd{method='PUT', user_ctx=Ctx}=Req, Db, DocId) ->
     W = couch_httpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db))),
     Options = [{user_ctx,Ctx}, {w,W}],
 
-    Loc = absolute_uri(Req, [$/, Db#db.name, $/, DocId]),
+    Loc = absolute_uri(Req, [$/, Db#db.name, $/, couch_util:url_encode(DocId)]),
     RespHeaders = [{"Location", Loc}],
     case couch_util:to_list(couch_httpd:header_value(Req, "Content-Type")) of
     ("multipart/related;" ++ _) = ContentType ->
@@ -1155,7 +1155,7 @@ db_attachment_req(#httpd{method=Method, user_ctx=Ctx}=Req, Db, DocId,
FileNamePa
         'DELETE' ->
             {200, []};
         _ ->
-            {HttpCode, [{"Location", absolute_uri(Req, [$/, DbName, $/, DocId, $/,
+            {HttpCode, [{"Location", absolute_uri(Req, [$/, DbName, $/, couch_util:url_encode(DocId),
$/,
                 FileName])}]}
         end,
     send_json(Req,Status, Headers, {[


Mime
View raw message