Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Decode percent-escapes in OG card route segments
Rūdolfs Ošiņš committed 14 days ago
commit 9e669eaf05b999406851072d92ae40ee24bfd495
parent 3f798744bbd1a7327a23aab32b39d27ef4885736
1 file changed +10 -1
modified workers/open-graph/index.js
@@ -38,7 +38,16 @@ function ensureInit() {
}

function parseRoute(pathname) {
-
  const segments = pathname.replace(/^\//, "").split("/");
+
  const segments = pathname
+
    .replace(/^\//, "")
+
    .split("/")
+
    .map(s => {
+
      try {
+
        return decodeURIComponent(s);
+
      } catch {
+
        return s;
+
      }
+
    });
  const first = segments[0];

  if (first === "" || first === undefined) return { type: "home" };