Skip to content

Commit dbbec01

Browse files
committed
Cryptor encrypt/decryptContent fails if source does not exist
1 parent 7fd5dc7 commit dbbec01

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/CryptomatorCryptoLib/Cryptor.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ public class Cryptor {
216216
defer { ciphertextStream.close() }
217217

218218
// determine cleartext size:
219-
let attributes = try? FileManager.default.attributesOfItem(atPath: cleartextURL.path)
220-
let cleartextSize = attributes?[FileAttributeKey.size] as? Int
219+
let attributes = try FileManager.default.attributesOfItem(atPath: cleartextURL.path)
220+
let cleartextSize = attributes[FileAttributeKey.size] as? Int
221221

222222
// encrypt:
223223
try encryptContent(from: cleartextStream, to: ciphertextStream, cleartextSize: cleartextSize)
@@ -277,8 +277,8 @@ public class Cryptor {
277277
defer { cleartextStream.close() }
278278

279279
// determine ciphertext size:
280-
let attributes = try? FileManager.default.attributesOfItem(atPath: ciphertextURL.path)
281-
let ciphertextSize = attributes?[FileAttributeKey.size] as? Int
280+
let attributes = try FileManager.default.attributesOfItem(atPath: ciphertextURL.path)
281+
let ciphertextSize = attributes[FileAttributeKey.size] as? Int
282282

283283
// decrypt:
284284
try decryptContent(from: ciphertextStream, to: cleartextStream, ciphertextSize: ciphertextSize)

0 commit comments

Comments
 (0)