TelegramPWA/src/util/ensureProtocol.ts
2021-11-27 17:41:00 +01:00

10 lines
294 B
TypeScript

export function ensureProtocol(url?: string) {
if (!url) {
return undefined;
}
// HTTP was chosen by default as a fix for https://bugs.telegram.org/c/10712.
// It is also the default protocol in the official TDesktop client.
return url.includes('://') ? url : `http://${url}`;
}