mirror of
https://github.com/immich-app/immich.git
synced 2025-10-19 21:10:39 -04:00
fix(web): handle multiple downloads in safari (#21259)
This commit is contained in:
parent
d9d8beb92f
commit
63088b22e0
@ -74,6 +74,10 @@ class ApiError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const sleep = (ms: number) => {
|
||||||
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
};
|
||||||
|
|
||||||
export const uploadRequest = async <T>(options: UploadRequestOptions): Promise<{ data: T; status: number }> => {
|
export const uploadRequest = async <T>(options: UploadRequestOptions): Promise<{ data: T; status: number }> => {
|
||||||
const { onUploadProgress: onProgress, data, url } = options;
|
const { onUploadProgress: onProgress, data, url } = options;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import { assetsSnapshot } from '$lib/managers/timeline-manager/utils.svelte';
|
|||||||
import type { AssetInteraction } from '$lib/stores/asset-interaction.svelte';
|
import type { AssetInteraction } from '$lib/stores/asset-interaction.svelte';
|
||||||
import { isSelectingAllAssets } from '$lib/stores/assets-store.svelte';
|
import { isSelectingAllAssets } from '$lib/stores/assets-store.svelte';
|
||||||
import { preferences } from '$lib/stores/user.store';
|
import { preferences } from '$lib/stores/user.store';
|
||||||
import { downloadRequest, withError } from '$lib/utils';
|
import { downloadRequest, sleep, withError } from '$lib/utils';
|
||||||
import { getByteUnitString } from '$lib/utils/byte-units';
|
import { getByteUnitString } from '$lib/utils/byte-units';
|
||||||
import { getFormatter } from '$lib/utils/i18n';
|
import { getFormatter } from '$lib/utils/i18n';
|
||||||
import { navigate } from '$lib/utils/navigation';
|
import { navigate } from '$lib/utils/navigation';
|
||||||
@ -278,7 +278,12 @@ export const downloadFile = async (asset: AssetResponseDto) => {
|
|||||||
|
|
||||||
const queryParams = asQueryString(authManager.params);
|
const queryParams = asQueryString(authManager.params);
|
||||||
|
|
||||||
for (const { filename, id } of assets) {
|
for (const [i, { filename, id }] of assets.entries()) {
|
||||||
|
if (i !== 0) {
|
||||||
|
// play nice with Safari
|
||||||
|
await sleep(500);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
notificationController.show({
|
notificationController.show({
|
||||||
type: NotificationType.Info,
|
type: NotificationType.Info,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user