diff options
author | Roopesh Chander <roop@roopc.net> | 2019-02-09 19:24:08 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2019-02-09 19:42:50 +0530 |
commit | 0a3a5ee900336eb96fc72f6fbfec18091e4b873a (patch) | |
tree | ec9c196f1a7a35657b1fc9ef1075937064fbfc2b /WireGuard/WireGuard/ZipArchive/ZipArchive.swift | |
parent | TunnelsManager: No need to access tunnelConfiguration on status change (diff) | |
download | wireguard-apple-0a3a5ee900336eb96fc72f6fbfec18091e4b873a.tar.xz wireguard-apple-0a3a5ee900336eb96fc72f6fbfec18091e4b873a.zip |
Importing: Ignore case in matching file extensions inside zip files
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/ZipArchive/ZipArchive.swift')
-rw-r--r-- | WireGuard/WireGuard/ZipArchive/ZipArchive.swift | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/WireGuard/WireGuard/ZipArchive/ZipArchive.swift b/WireGuard/WireGuard/ZipArchive/ZipArchive.swift index 9e28dc2..2cca880 100644 --- a/WireGuard/WireGuard/ZipArchive/ZipArchive.swift +++ b/WireGuard/WireGuard/ZipArchive/ZipArchive.swift @@ -42,6 +42,7 @@ class ZipArchive { static func unarchive(url: URL, requiredFileExtensions: [String]) throws -> [(fileBaseName: String, contents: Data)] { var results = [(fileBaseName: String, contents: Data)]() + var requiredFileExtensionsLowercased = requiredFileExtensions.map { $0.lowercased() } guard let zipFile = unzOpen64(url.path) else { throw ZipArchiveError.cantOpenInputZipFile @@ -70,7 +71,7 @@ class ZipArchive { let isDirectory = (lastChar == "/" || lastChar == "\\") let fileURL = URL(fileURLWithFileSystemRepresentation: fileNameBuffer, isDirectory: isDirectory, relativeTo: nil) - if !isDirectory && requiredFileExtensions.contains(fileURL.pathExtension) { + if !isDirectory && requiredFileExtensionsLowercased.contains(fileURL.pathExtension.lowercased()) { var unzippedData = Data() var bytesRead: Int32 = 0 repeat { |