mirror of
https://github.com/immich-app/immich.git
synced 2025-12-19 17:23:21 +03:00
fix(web): don't ask password for invalid shared link (#7456)
* fix(web): don't ask password for invalid shared link * use apiUtils for e2e test
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Opps! Error - Immich</title>
|
||||
</svelte:head>
|
||||
|
||||
<section class="flex h-screen w-screen place-content-center place-items-center">
|
||||
<div class="p-20 text-4xl text-immich-primary dark:text-immich-dark-primary">Page not found :/</div>
|
||||
<section class="flex flex-col px-4 h-screen w-screen place-content-center place-items-center">
|
||||
<h1 class="py-10 text-4xl text-immich-primary dark:text-immich-dark-primary">Page not found :/</h1>
|
||||
{#if $page.error?.message}
|
||||
<h2 class="text-xl text-immich-fg dark:text-immich-dark-fg">{$page.error.message}</h2>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { getAssetThumbnailUrl } from '$lib/utils';
|
||||
import { authenticate } from '$lib/utils/auth';
|
||||
import { ThumbnailFormat, getMySharedLink } from '@immich/sdk';
|
||||
import { error as throwError, type HttpError } from '@sveltejs/kit';
|
||||
import { ThumbnailFormat, getMySharedLink, isHttpError } from '@immich/sdk';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load = (async ({ params }) => {
|
||||
@@ -22,9 +21,7 @@ export const load = (async ({ params }) => {
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
// handle unauthorized error
|
||||
// TODO this doesn't allow for 404 shared links anymore
|
||||
if ((error as HttpError).status === 401) {
|
||||
if (isHttpError(error) && error.data.message === 'Invalid password') {
|
||||
return {
|
||||
passwordRequired: true,
|
||||
sharedLinkKey: key,
|
||||
@@ -34,8 +31,6 @@ export const load = (async ({ params }) => {
|
||||
};
|
||||
}
|
||||
|
||||
throwError(404, {
|
||||
message: 'Invalid shared link',
|
||||
});
|
||||
throw error;
|
||||
}
|
||||
}) satisfies PageLoad;
|
||||
|
||||
Reference in New Issue
Block a user