From 0cce116a0ae8cd932d9f27291c95b086efa78153 Mon Sep 17 00:00:00 2001 From: oratis Date: Sun, 14 Jun 2026 14:41:37 +0800 Subject: [PATCH] fix(ios): clearer error when a repo is too large (Zip64) to open as a vault MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A repo whose zipball exceeds 4 GB is Zip64, which the archive reader can't parse (it would silently drop entries), so it was rejected with the generic "Couldn't read the repository archive." Add a distinct .repoTooLarge case: "This repository is too large to open as a vault (over 4 GB). Try opening a sub-folder instead." app simulator build ✓. Co-Authored-By: Claude Opus 4.8 (1M context) --- ios/MarkupApp/MarkupApp/GitHubService.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ios/MarkupApp/MarkupApp/GitHubService.swift b/ios/MarkupApp/MarkupApp/GitHubService.swift index b4ebe87..8ab0684 100644 --- a/ios/MarkupApp/MarkupApp/GitHubService.swift +++ b/ios/MarkupApp/MarkupApp/GitHubService.swift @@ -9,7 +9,7 @@ final class GitHubService { static let shared = GitHubService() enum GitHubError: LocalizedError { - case notAFile, rateLimited, forbidden, notFound, http(Int), badURL, badArchive + case notAFile, rateLimited, forbidden, notFound, http(Int), badURL, badArchive, repoTooLarge var errorDescription: String? { switch self { case .notAFile: return "That link points to a folder, not a file." @@ -19,6 +19,8 @@ final class GitHubService { case .http(let c): return "GitHub request failed (HTTP \(c))." case .badURL: return "Couldn't build the request URL." case .badArchive: return "Couldn't read the repository archive." + case .repoTooLarge: + return "This repository is too large to open as a vault (over 4 GB). Try opening a sub-folder instead." } } } @@ -331,7 +333,9 @@ final class GitHubService { nonisolated static func extractZipball(_ data: Data, to root: URL) throws { // Fail loudly on zip64 rather than open a silently-incomplete vault: // ZipArchive can't parse it and would drop entries with no error. - if ZipArchive.isLikelyZip64(data) { throw GitHubError.badArchive } + // Zip64 (> 4 GB) — ZipArchive can't parse it and would silently drop + // entries; surface a clear "too large" message rather than a generic one. + if ZipArchive.isLikelyZip64(data) { throw GitHubError.repoTooLarge } let entries = ZipArchive.extract(data) guard let top = GitHubZipball.topLevelDir(entries.map(\.path)) else { throw GitHubError.badArchive