@capacitor/filesystem 5.1.3-nightly-20230822T150552.0 → 5.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -187,6 +187,7 @@ import Capacitor
|
|
|
187
187
|
call.reject("Invalid file path")
|
|
188
188
|
return
|
|
189
189
|
}
|
|
190
|
+
guard var urlString = call.getString("url") else { throw URLError(.badURL) }
|
|
190
191
|
|
|
191
192
|
func handleDownload(downloadLocation: URL?, response: URLResponse?, error: Error?) {
|
|
192
193
|
if let error = error {
|
|
@@ -196,6 +197,11 @@ import Capacitor
|
|
|
196
197
|
}
|
|
197
198
|
|
|
198
199
|
if let httpResponse = response as? HTTPURLResponse {
|
|
200
|
+
if !(200...299).contains(httpResponse.statusCode) {
|
|
201
|
+
CAPLog.print("Error downloading file:", urlString, httpResponse)
|
|
202
|
+
call.reject("Error downloading file: \(urlString)", "DOWNLOAD")
|
|
203
|
+
return
|
|
204
|
+
}
|
|
199
205
|
HttpRequestHandler.setCookiesFromResponse(httpResponse, config)
|
|
200
206
|
}
|
|
201
207
|
|
|
@@ -239,7 +245,6 @@ import Capacitor
|
|
|
239
245
|
}
|
|
240
246
|
}
|
|
241
247
|
|
|
242
|
-
guard var urlString = call.getString("url") else { throw URLError(.badURL) }
|
|
243
248
|
let method = call.getString("method", "GET")
|
|
244
249
|
|
|
245
250
|
let headers = (call.getObject("headers") ?? [:]) as [String: Any]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/filesystem",
|
|
3
|
-
"version": "5.1.3
|
|
3
|
+
"version": "5.1.3",
|
|
4
4
|
"description": "The Filesystem API provides a NodeJS-like API for working with files on the device.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|