URL: Use corrent method field (#5267)

This commit is contained in:
zubiden 2024-12-06 19:43:56 +04:00 committed by Alexander Zinchuk
parent 81386ba911
commit 87840629da

View File

@ -6,7 +6,6 @@ import type { DeepLinkMethod, PrivateMessageLink } from './deepLinkParser';
import { API_CHAT_TYPES, RE_TG_LINK } from '../config';
import { toChannelId } from '../global/helpers';
import { tryParseDeepLink } from './deepLinkParser';
import { IS_SAFARI } from './windowEnvironment';
export const processDeepLink = (url: string): boolean => {
const actions = getActions();
@ -54,13 +53,12 @@ export const processDeepLink = (url: string): boolean => {
}
const {
protocol, searchParams, pathname, hostname,
protocol, searchParams, hostname,
} = new URL(url);
if (protocol !== 'tg:') return false;
// Safari thinks the path in tg://path links is hostname for some reason
const method = (IS_SAFARI ? hostname : pathname).replace(/^\/\//, '') as DeepLinkMethod;
const method = hostname as DeepLinkMethod;
const params = Object.fromEntries(searchParams);
const {