Skip to content
2 changes: 2 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7227,6 +7227,8 @@ const CONST = {
RESCHEDULED: 'rescheduled',
CANCELLED: 'cancelled',
},

SIGNIN_ROUTE: '/signin',
} as const;

type Country = keyof typeof CONST.ALL_COUNTRIES;
Expand Down
8 changes: 7 additions & 1 deletion src/libs/Navigation/helpers/getAdaptedStateFromPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import getInitialSplitNavigatorState from '@libs/Navigation/AppNavigator/createS
import {config} from '@libs/Navigation/linkingConfig/config';
import {RHP_TO_SEARCH, RHP_TO_SETTINGS, RHP_TO_SIDEBAR, RHP_TO_WORKSPACE} from '@libs/Navigation/linkingConfig/RELATIONS';
import type {NavigationPartialRoute, RootNavigatorParamList} from '@libs/Navigation/types';
import CONST from '@src/CONST';
import NAVIGATORS from '@src/NAVIGATORS';
import ONYXKEYS from '@src/ONYXKEYS';
import SCREENS from '@src/SCREENS';
Expand Down Expand Up @@ -223,7 +224,12 @@ function getAdaptedState(state: PartialState<NavigationState<RootNavigatorParamL
* @throws Error if unable to get state from path
*/
const getAdaptedStateFromPath: GetAdaptedStateFromPath = (path, options, shouldReplacePathInNestedState = true) => {
const normalizedPath = !path.startsWith('/') ? `/${path}` : path;
let normalizedPath = !path.startsWith('/') ? `/${path}` : path;

// Bing search results still link to /signin when searching for “Expensify”, but the /signin route no longer exists in our repo, so we redirect it to the home page to avoid showing a Not Found page.
if (normalizedPath === CONST.SIGNIN_ROUTE) {
normalizedPath = '/';
}

const state = getStateFromPath(normalizedPath, options) as PartialState<NavigationState<RootNavigatorParamList>>;
if (shouldReplacePathInNestedState) {
Expand Down
8 changes: 7 additions & 1 deletion src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import Log from '@libs/Log';
import {registerPaginationConfig} from '@libs/Middleware/Pagination';
import {isOnboardingFlowName} from '@libs/Navigation/helpers/isNavigatorName';
import type {LinkToOptions} from '@libs/Navigation/helpers/linkTo/types';
import normalizePath from '@libs/Navigation/helpers/normalizePath';
import shouldOpenOnAdminRoom from '@libs/Navigation/helpers/shouldOpenOnAdminRoom';
import Navigation, {navigationRef} from '@libs/Navigation/Navigation';
import enhanceParameters from '@libs/Network/enhanceParameters';
Expand Down Expand Up @@ -3361,7 +3362,12 @@ function openReportFromDeepLink(url: string) {
Onyx.set(ONYXKEYS.IS_CHECKING_PUBLIC_ROOM, false);
}

const route = getRouteFromLink(url);
let route = getRouteFromLink(url);

// Bing search results still link to /signin when searching for “Expensify”, but the /signin route no longer exists in our repo, so we redirect it to the home page to avoid showing a Not Found page.
if (normalizePath(route) === CONST.SIGNIN_ROUTE) {
route = '';
}

// If we are not authenticated and are navigating to a public screen, we don't want to navigate again to the screen after sign-in/sign-up
if (!isAuthenticated && isPublicScreenRoute(route)) {
Expand Down