mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-11 02:46:16 -08:00
fix(downloads): ignore fragments in shell route state
This commit is contained in:
1 parent
05ea3ad636
commit
5fd9b2eb35
2 files changed
+53
-1
No files matched your search
@@ -180,6 +180,57 @@ describe('workspace-shell-route.utils', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('ignores fragments when identifying download manager routes', () => {
|
||||
expect(
|
||||
parseWorkspaceShellRoute('/workspace/downloads/#details')
|
||||
).toEqual(
|
||||
expect.objectContaining({
|
||||
kind: 'downloads',
|
||||
contextPanel: 'none',
|
||||
searchMode: 'local-filter',
|
||||
usesQuerySearch: true,
|
||||
})
|
||||
);
|
||||
expect(
|
||||
parseWorkspaceShellRoute(
|
||||
'/workspace/xtreams/pl-1/downloads/#details'
|
||||
)
|
||||
).toEqual(
|
||||
expect.objectContaining({
|
||||
kind: 'portal',
|
||||
section: 'downloads',
|
||||
contextPanel: 'collection',
|
||||
searchMode: 'local-filter',
|
||||
usesQuerySearch: true,
|
||||
})
|
||||
);
|
||||
expect(
|
||||
parseWorkspaceShellRoute(
|
||||
'/workspace/stalker/pl-1/downloads/#details'
|
||||
)
|
||||
).toEqual(
|
||||
expect.objectContaining({
|
||||
kind: 'portal',
|
||||
section: 'downloads',
|
||||
contextPanel: 'collection',
|
||||
searchMode: 'local-filter',
|
||||
usesQuerySearch: true,
|
||||
})
|
||||
);
|
||||
expect(
|
||||
parseWorkspaceShellRoute(
|
||||
'/workspace/downloads/#details?query=ignored'
|
||||
)
|
||||
).toEqual(
|
||||
expect.objectContaining({
|
||||
kind: 'downloads',
|
||||
contextPanel: 'none',
|
||||
searchMode: 'local-filter',
|
||||
usesQuerySearch: true,
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('parses Xtream portal routes and detects context-panel/query-search state', () => {
|
||||
expect(
|
||||
parseWorkspaceShellRoute('/workspace/xtreams/pl-1/vod/42')
|
||||
|
||||
@@ -86,7 +86,8 @@ function normalizePath(url: string): {
|
||||
segments: string[];
|
||||
queryParams: URLSearchParams;
|
||||
} {
|
||||
const [path, query = ''] = url.split('?');
|
||||
const [pathWithFragment, query = ''] = url.split('?');
|
||||
const [path] = pathWithFragment.split('#');
|
||||
return {
|
||||
segments: path.split('/').filter(Boolean),
|
||||
queryParams: new URLSearchParams(query),
|
||||
|
||||
Reference in new issue
Block a user