mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-26 08:12:33 -04:00 
			
		
		
		
	fix(web): update unauthorized share link handling (#7126)
This commit is contained in:
		
							parent
							
								
									9b814354a4
								
							
						
					
					
						commit
						dabbd63a02
					
				| @ -13,7 +13,6 @@ import { | |||||||
|   unlinkOAuthAccount, |   unlinkOAuthAccount, | ||||||
|   type UserResponseDto, |   type UserResponseDto, | ||||||
| } from '@immich/sdk'; | } from '@immich/sdk'; | ||||||
| import { common } from '@immich/sdk/axios'; |  | ||||||
| import { get } from 'svelte/store'; | import { get } from 'svelte/store'; | ||||||
| 
 | 
 | ||||||
| interface UpdateParamAction { | interface UpdateParamAction { | ||||||
| @ -91,7 +90,7 @@ const createUrl = (path: string, parameters?: Record<string, unknown>) => { | |||||||
|   const url = new URL(path, 'https://example.com'); |   const url = new URL(path, 'https://example.com'); | ||||||
|   url.search = searchParameters.toString(); |   url.search = searchParameters.toString(); | ||||||
| 
 | 
 | ||||||
|   return defaults.baseUrl + common.toPathString(url); |   return defaults.baseUrl + url.pathname + url.search + url.hash; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| export const getAssetFileUrl = (...[assetId, isWeb, isThumb]: [string, boolean, boolean]) => { | export const getAssetFileUrl = (...[assetId, isWeb, isThumb]: [string, boolean, boolean]) => { | ||||||
|  | |||||||
| @ -1,8 +1,7 @@ | |||||||
| import { getAssetThumbnailUrl } from '$lib/utils'; | import { getAssetThumbnailUrl } from '$lib/utils'; | ||||||
| import { authenticate } from '$lib/utils/auth'; | import { authenticate } from '$lib/utils/auth'; | ||||||
| import { ThumbnailFormat, getMySharedLink } from '@immich/sdk'; | import { ThumbnailFormat, getMySharedLink } from '@immich/sdk'; | ||||||
| import { error as throwError } from '@sveltejs/kit'; | import { error as throwError, type HttpError } from '@sveltejs/kit'; | ||||||
| import type { AxiosError } from 'axios'; |  | ||||||
| import type { PageLoad } from './$types'; | import type { PageLoad } from './$types'; | ||||||
| 
 | 
 | ||||||
| export const load = (async ({ params }) => { | export const load = (async ({ params }) => { | ||||||
| @ -25,7 +24,7 @@ export const load = (async ({ params }) => { | |||||||
|   } catch (error) { |   } catch (error) { | ||||||
|     // handle unauthorized error
 |     // handle unauthorized error
 | ||||||
|     // TODO this doesn't allow for 404 shared links anymore
 |     // TODO this doesn't allow for 404 shared links anymore
 | ||||||
|     if ((error as AxiosError).response?.status === 401) { |     if ((error as HttpError).status === 401) { | ||||||
|       return { |       return { | ||||||
|         passwordRequired: true, |         passwordRequired: true, | ||||||
|         sharedLinkKey: key, |         sharedLinkKey: key, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user