We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cfe2950 commit 021b8cbCopy full SHA for 021b8cb
ios/Sources/GutenbergKit/Sources/EditorAssetsLibrary.swift
@@ -99,8 +99,12 @@ public actor EditorAssetsLibrary {
99
try fileManager.createDirectory(at: localURL.deletingLastPathComponent(), withIntermediateDirectories: true)
100
}
101
102
- let (downloaded, _) = try await urlSession.download(from: httpURL)
103
- try fileManager.moveItem(at: downloaded, to: localURL)
+ let (downloaded, response) = try await urlSession.download(from: httpURL)
+ if let status = (response as? HTTPURLResponse)?.statusCode, (200..<300).contains(status) {
104
+ try fileManager.moveItem(at: downloaded, to: localURL)
105
+ } else {
106
+ throw URLError(.badServerResponse)
107
+ }
108
109
110
return localURL
0 commit comments