diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2023-10-27 16:10:21 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2023-10-30 13:46:46 +0100 |
| commit | f2d8a5448baec13fd83ec225a81fd609fde56165 (patch) | |
| tree | f40f9fa22f4fe9092cb48db72f7e8fda1c084be2 /ios | |
| parent | 5053d29992b29bbcdcd683e1ae2575008111d793 (diff) | |
| download | mullvadvpn-f2d8a5448baec13fd83ec225a81fd609fde56165.tar.xz mullvadvpn-f2d8a5448baec13fd83ec225a81fd609fde56165.zip | |
Exclude transaction log from backups
Diffstat (limited to 'ios')
| -rw-r--r-- | ios/MullvadVPN/StorePaymentManager/StoreTransactionLog.swift | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ios/MullvadVPN/StorePaymentManager/StoreTransactionLog.swift b/ios/MullvadVPN/StorePaymentManager/StoreTransactionLog.swift index f678b39131..8d380bdc44 100644 --- a/ios/MullvadVPN/StorePaymentManager/StoreTransactionLog.swift +++ b/ios/MullvadVPN/StorePaymentManager/StoreTransactionLog.swift @@ -137,9 +137,25 @@ final class StoreTransactionLog { } /// Write a list of transaction identifiers on disk. + /// /// Transaction identifiers are stored as one per line. + /// Always ensures to exclude the transaction log file from backups after writing contents on disk. /// - Parameter serializedString: serialized transaction log private func persistInner(serializedString: String) throws { try serializedString.write(to: fileURL, atomically: true, encoding: .utf8) + excludeFromBackups() + } + + /// Exclude transaction log file from backups. + private func excludeFromBackups() { + do { + var resourceValues = URLResourceValues() + resourceValues.isExcludedFromBackup = true + + var mutableFileURL = fileURL + try mutableFileURL.setResourceValues(resourceValues) + } catch { + logger.error(error: error, message: "Failed to exclude transaction log from backups.") + } } } |
