Skip to content

Commit

Permalink
Increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
weichsel committed Jun 10, 2024
1 parent f27f12a commit a5177fe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Sources/ZIPFoundation/Archive.swift
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,11 @@ public final class Archive: Sequence {

private static func scanForZIP64EndOfCentralDirectory(in file: FILEPointer, eocdOffset: UInt64)
-> ZIP64EndOfCentralDirectory? {
guard UInt64(ZIP64EndOfCentralDirectoryLocator.size) < eocdOffset else {
return nil
}
guard UInt64(ZIP64EndOfCentralDirectoryLocator.size) < eocdOffset else { return nil }

Check failure on line 301 in Sources/ZIPFoundation/Archive.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
let locatorOffset = eocdOffset - UInt64(ZIP64EndOfCentralDirectoryLocator.size)
guard UInt64(ZIP64EndOfCentralDirectoryRecord.size) < locatorOffset else { return nil }

guard UInt64(ZIP64EndOfCentralDirectoryRecord.size) < locatorOffset else {
return nil
}
let recordOffset = locatorOffset - UInt64(ZIP64EndOfCentralDirectoryRecord.size)
guard let locator: ZIP64EndOfCentralDirectoryLocator = Data.readStruct(from: file, at: locatorOffset),
let record: ZIP64EndOfCentralDirectoryRecord = Data.readStruct(from: file, at: recordOffset) else {
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ extension ZIPFoundationTests {
XCTAssert(result == true)
XCTAssertSwiftError(try Archive(url: noEndOfCentralDirectoryArchiveURL, accessMode: .read),
throws: Archive.ArchiveError.missingEndOfCentralDirectoryRecord)
let invalidEndOfCentralDirectoryArchiveURL = self.resourceURL(for: #function, pathExtension: "zip")
XCTAssertSwiftError(try Archive(url: invalidEndOfCentralDirectoryArchiveURL, accessMode: .read),
throws: Archive.ArchiveError.missingEndOfCentralDirectoryRecord)
self.runWithUnprivilegedGroup {
var unreadableArchiveURL = ZIPFoundationTests.tempZipDirectoryURL
unreadableArchiveURL.appendPathComponent(processInfo.globallyUniqueString)
Expand Down

0 comments on commit a5177fe

Please sign in to comment.