summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/site.cc5
-rw-r--r--src/transport.cc4
2 files changed, 6 insertions, 3 deletions
diff --git a/src/site.cc b/src/site.cc
index f8d8116..ebc12a7 100644
--- a/src/site.cc
+++ b/src/site.cc
@@ -91,8 +91,9 @@ public:
if (slash == std::string::npos) {
auto trip_id = request->path().substr(1);
if (trip_.count(std::string(trip_id)))
- return transport->create_redirect(std::string(request->path()) + "/",
- false);
+ return transport->create_redirect(
+ url::escape(request->path(), url::EscapeFlags::KEEP_SLASH) + "/",
+ false);
} else {
auto trip_id = std::string(request->path().substr(1, slash - 1));
auto trip_it = trip_.find(trip_id);
diff --git a/src/transport.cc b/src/transport.cc
index 8195db7..50f83e4 100644
--- a/src/transport.cc
+++ b/src/transport.cc
@@ -3,6 +3,7 @@
#include "pathutil.hh"
#include "strutil.hh"
#include "transport.hh"
+#include "urlutil.hh"
#include <utility>
@@ -87,7 +88,8 @@ public:
auto clean_path = path::cleanup(request->path());
if (clean_path != request->path()) {
- auto response = transport->create_redirect(clean_path, false);
+ auto response = transport->create_redirect(
+ url::escape(clean_path, url::EscapeFlags::KEEP_SLASH), false);
return response;
}