Niedzielski has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385093 )

Change subject: Fix: handle question marks
......................................................................

Fix: handle question marks

- Treat question marks as part of the path passed to the router.

- Encode question marks in page titles before issuing a RESTBase
  request.

Change-Id: Ife6de3af8841bfeca6a704a3729169ac3472a37e
---
M src/client/index.tsx
M src/common/data-clients/restbase-title-encoder.ts
2 files changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/marvin refs/changes/93/385093/1

diff --git a/src/client/index.tsx b/src/client/index.tsx
index 79b273b..05da8b4 100644
--- a/src/client/index.tsx
+++ b/src/client/index.tsx
@@ -39,4 +39,4 @@
 // Replace the server rendered root, which does not include CSS, with a styled
 // page that manages navigation with History. This enables the single page app
 // experience.
-route(location.pathname);
+route(location.href.replace(location.origin, ""));
diff --git a/src/common/data-clients/restbase-title-encoder.ts 
b/src/common/data-clients/restbase-title-encoder.ts
index 6dfab56..e8ff6d8 100644
--- a/src/common/data-clients/restbase-title-encoder.ts
+++ b/src/common/data-clients/restbase-title-encoder.ts
@@ -6,6 +6,9 @@
   // RESTBase doesn't understand page titles with slashes in them. An encoded
   // path cannot be blindly reencoded with encodeURIComponent() because that 
may
   // doubly encode characters which gives different meaning when its unencoded
-  // only once. Instead, target slashes specifically.
-  return title.replace("/", "%2f");
+  // only once. Instead, target slashes specifically. Ampersands (&) and 
percent
+  // signs (%) are understood.
+  // http://localhost:3000/wiki//
+  // http://localhost:3000/wiki/?
+  return title.replace("/", "%2f").replace("?", "%3f");
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/385093
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ife6de3af8841bfeca6a704a3729169ac3472a37e
Gerrit-PatchSet: 1
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org>
Gerrit-Reviewer: Sniedzielski <sniedziel...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to