Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Allow trailing slashes in seed API
Alexis Sellier committed 4 years ago
commit e39e425ec47390069a220ac61ed9bdc5688af896
parent c90cf21952f972486e19fbabee0bfa328e890b84
2 files changed +3 -2
modified src/api.ts
@@ -14,8 +14,9 @@ export async function get(
    query[key] = val.toString();
  }

+
  const base = config.seed.api.replace(/\/$/, "");
  const search = new URLSearchParams(query).toString();
-
  const baseUrl = `${config.seed.api}/v1/${path}`;
+
  const baseUrl = `${base}/v1/${path}`;
  const url = search ? `${baseUrl}?${search}` : baseUrl;

  let response = null;
modified src/config.ts
@@ -129,7 +129,7 @@ export class Config {
  withSeed(seed: string): Config {
    const cfg = {} as Config;
    Object.assign(cfg, this);
-
    cfg.seed.api = seed;
+
    cfg.seed.api = seed.replace(/\/$/, "");

    return cfg;
  }