Expired sign-in, save-progress, email-change, and invitation tokens (and any draft they carry) are cleared by a Cloudron scheduler task. Page timing logs record the path without the query string, and mail failures log a request id instead of an address.
16 lines
472 B
TypeScript
16 lines
472 B
TypeScript
/**
|
|
* Origin + path, with query string and hash removed.
|
|
* Invitation and login tokens travel in the query string; share slugs are path.
|
|
*/
|
|
export function pathOnlyUrl(raw: string): string {
|
|
try {
|
|
const url = new URL(raw);
|
|
return `${url.origin}${url.pathname}`;
|
|
} catch {
|
|
const cut = [raw.indexOf("?"), raw.indexOf("#")]
|
|
.filter((index) => index >= 0)
|
|
.sort((a, b) => a - b)[0];
|
|
return cut === undefined ? raw : raw.slice(0, cut);
|
|
}
|
|
}
|