mirror of
https://github.com/immich-app/immich.git
synced 2026-03-27 04:11:15 +03:00
fix: download original stale cache when edited (#27195)
This commit is contained in:
@@ -8,17 +8,16 @@ import SharedLinkCreateModal from '$lib/modals/SharedLinkCreateModal.svelte';
|
|||||||
import { isFaceEditMode } from '$lib/stores/face-edit.svelte';
|
import { isFaceEditMode } from '$lib/stores/face-edit.svelte';
|
||||||
import { user as authUser, preferences } from '$lib/stores/user.store';
|
import { user as authUser, preferences } from '$lib/stores/user.store';
|
||||||
import type { AssetControlContext } from '$lib/types';
|
import type { AssetControlContext } from '$lib/types';
|
||||||
import { getSharedLink, sleep } from '$lib/utils';
|
import { getAssetMediaUrl, getSharedLink, sleep } from '$lib/utils';
|
||||||
import { downloadUrl } from '$lib/utils/asset-utils';
|
import { downloadUrl } from '$lib/utils/asset-utils';
|
||||||
import { handleError } from '$lib/utils/handle-error';
|
import { handleError } from '$lib/utils/handle-error';
|
||||||
import { getFormatter } from '$lib/utils/i18n';
|
import { getFormatter } from '$lib/utils/i18n';
|
||||||
import { asQueryString } from '$lib/utils/shared-links';
|
|
||||||
import {
|
import {
|
||||||
AssetJobName,
|
AssetJobName,
|
||||||
|
AssetMediaSize,
|
||||||
AssetTypeEnum,
|
AssetTypeEnum,
|
||||||
AssetVisibility,
|
AssetVisibility,
|
||||||
getAssetInfo,
|
getAssetInfo,
|
||||||
getBaseUrl,
|
|
||||||
runAssetJobs,
|
runAssetJobs,
|
||||||
updateAsset,
|
updateAsset,
|
||||||
type AssetJobsDto,
|
type AssetJobsDto,
|
||||||
@@ -308,6 +307,7 @@ export const handleDownloadAsset = async (asset: AssetResponseDto, { edited }: {
|
|||||||
{
|
{
|
||||||
filename: asset.originalFileName,
|
filename: asset.originalFileName,
|
||||||
id: asset.id,
|
id: asset.id,
|
||||||
|
cacheKey: asset.thumbhash,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -321,13 +321,12 @@ export const handleDownloadAsset = async (asset: AssetResponseDto, { edited }: {
|
|||||||
assets.push({
|
assets.push({
|
||||||
filename: motionAsset.originalFileName,
|
filename: motionAsset.originalFileName,
|
||||||
id: asset.livePhotoVideoId,
|
id: asset.livePhotoVideoId,
|
||||||
|
cacheKey: motionAsset.thumbhash,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const queryParams = asQueryString(authManager.params);
|
for (const [i, { filename, id, cacheKey }] of assets.entries()) {
|
||||||
|
|
||||||
for (const [i, { filename, id }] of assets.entries()) {
|
|
||||||
if (i !== 0) {
|
if (i !== 0) {
|
||||||
// play nice with Safari
|
// play nice with Safari
|
||||||
await sleep(500);
|
await sleep(500);
|
||||||
@@ -335,12 +334,7 @@ export const handleDownloadAsset = async (asset: AssetResponseDto, { edited }: {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
toastManager.primary($t('downloading_asset_filename', { values: { filename } }));
|
toastManager.primary($t('downloading_asset_filename', { values: { filename } }));
|
||||||
downloadUrl(
|
downloadUrl(getAssetMediaUrl({ id, size: AssetMediaSize.Original, edited, cacheKey }), filename);
|
||||||
getBaseUrl() +
|
|
||||||
`/assets/${id}/original` +
|
|
||||||
(queryParams ? `?${queryParams}&edited=${edited}` : `?edited=${edited}`),
|
|
||||||
filename,
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(error, $t('errors.error_downloading', { values: { filename } }));
|
handleError(error, $t('errors.error_downloading', { values: { filename } }));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user