From b041ba84a960d973bb0548bf1c486afbf6829bf4 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Mon, 18 Sep 2023 19:46:56 +0200 Subject: [PATCH] Stories --- .../Sources/Network/MultipartFetch.swift | 9 +++++++++ .../Resources/TelegramEngineResources.swift | 13 +++++++++++-- .../Sources/PeerInfo/PeerInfoHeaderNode.swift | 6 ++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/submodules/TelegramCore/Sources/Network/MultipartFetch.swift b/submodules/TelegramCore/Sources/Network/MultipartFetch.swift index be2a615e61..5c9a473a3a 100644 --- a/submodules/TelegramCore/Sources/Network/MultipartFetch.swift +++ b/submodules/TelegramCore/Sources/Network/MultipartFetch.swift @@ -57,6 +57,7 @@ private enum MultipartFetchDownloadError { case revalidateMediaReference case hashesMissing case fatal + case webfileNotAvailable } private enum MultipartFetchGenericLocationResult { @@ -351,6 +352,8 @@ private enum MultipartFetchSource { |> mapError { error -> MultipartFetchDownloadError in if error.errorDescription.hasPrefix("FILEREF_INVALID") || error.errorDescription.hasPrefix("FILE_REFERENCE_") { return .revalidateMediaReference + } else if error.errorDescription == "WEBFILE_NOT_AVAILABLE" { + return .webfileNotAvailable } return .generic } @@ -379,6 +382,9 @@ private enum MultipartFetchSource { case let .web(_, location): return download.request(Api.functions.upload.getWebFile(location: location, offset: Int32(offset), limit: Int32(limit)), tag: tag, continueInBackground: continueInBackground, expectedResponseSize: Int32(limit)) |> mapError { error -> MultipartFetchDownloadError in + if error.errorDescription == "WEBFILE_NOT_AVAILABLE" { + return .webfileNotAvailable + } return .fatal } |> mapToSignal { result, info -> Signal<(Data, NetworkResponseInfo), MultipartFetchDownloadError> in @@ -930,6 +936,9 @@ private final class MultipartFetchManager { } case .hashesMissing: break + case .webfileNotAvailable: + strongSelf.completeSize = 0 + strongSelf.checkState() } })) } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Resources/TelegramEngineResources.swift b/submodules/TelegramCore/Sources/TelegramEngine/Resources/TelegramEngineResources.swift index e9f0aa9388..f49db12037 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Resources/TelegramEngineResources.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Resources/TelegramEngineResources.swift @@ -65,8 +65,17 @@ func bufferedFetch(_ signal: Signal