Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Commit

Permalink
Fix Travis build
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-menu committed Dec 23, 2020
1 parent c029849 commit fabd504
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions r2-shared-swift/Publication/Asset/FileAsset.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@ public final class FileAsset: PublicationAsset, Loggable {
}()

public func makeFetcher(using dependencies: PublicationAssetDependencies, credentials: String?, completion: @escaping (CancellableResult<Fetcher, Publication.OpeningError>) -> Void) {
DispatchQueue.global(qos: .background).async { [self] in
guard (try? url.checkResourceIsReachable()) == true else {
DispatchQueue.global(qos: .background).async {
guard (try? self.url.checkResourceIsReachable()) == true else {
completion(.failure(.notFound))
return
}

do {
// Attempts to open the file as a ZIP or exploded directory.
let archive = try dependencies.archiveFactory.open(url: url, password: credentials)
let archive = try dependencies.archiveFactory.open(url: self.url, password: credentials)
completion(.success(ArchiveFetcher(archive: archive)))

} catch ArchiveError.invalidPassword {
completion(.failure(.incorrectCredentials))

} catch {
// Falls back on serving the file as a single resource.
completion(.success(FileFetcher(href: "/\(name)", path: url)))
completion(.success(FileFetcher(href: "/\(self.name)", path: self.url)))
}
}
}
Expand Down

0 comments on commit fabd504

Please sign in to comment.