Skip to content

Commit

Permalink
code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
narthur committed Aug 18, 2023
1 parent 14845dc commit cba3698
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/canonicalizeUrl.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default function canonicalizeUrl(url: string): string {
// Start with basic cleanup canonicalization applicable to all URLs...
url = url.trim(); // trim whitespace
if (!url.match(/^https?:\/\//i)) url = "https://" + url // add protocol
if (!url.match(/^https?:\/\//i)) url = "https://" + url; // add protocol
url = url.replace(/\/+$/, ""); // kill trailing slashes
// TODO: fail loudly if the URL is mangled somehow

Expand All @@ -20,6 +20,6 @@ export default function canonicalizeUrl(url: string): string {
url = url.replace(/^(https?:\/\/padm\.us)$/, "$1/public/export/txt");
// And finally the key transformation: append /export/txt for etherpad:
url = url.replace(/^(https?:\/\/padm\.us)\/([^/]+)$/, "$1/$2/export/txt");

return url;
}

0 comments on commit cba3698

Please sign in to comment.