Remove file deletion error

multistore
Laurent 1 year ago
parent 102be89a83
commit 164e63363c
  1. 1
      LeStorage/Services.swift
  2. 4
      LeStorage/StoredCollection.swift

@ -207,7 +207,6 @@ public class Services {
request.httpBody = apiCall.body.data(using: .utf8)
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
if let method = HTTPMethod(rawValue: apiCall.method), self._isTokenRequired(type: T.self, method: method) {
do {
let token = try self.keychainStore.getToken()

@ -352,7 +352,9 @@ public class StoredCollection<T: Storable>: RandomAccessCollection, SomeCollecti
do {
let url: URL = try self._urlForJSONFile()
try FileManager.default.removeItem(at: url)
if FileManager.default.fileExists(atPath: url.path()) {
try FileManager.default.removeItem(at: url)
}
} catch {
Logger.error(error)
}

Loading…
Cancel
Save