File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -367,15 +367,19 @@ open class Client {
367
367
368
368
if idParamName != nil && params[idParamName!] as! String != "unique()" {
369
369
// Make a request to check if a file already exists
370
- let map = try! await call(
371
- method: "GET",
372
- path: path + "/" + (params[idParamName!] as! String),
373
- headers: headers,
374
- params: [:],
375
- converter: { return $0 }
376
- )
377
- let chunksUploaded = map["chunksUploaded"] as! Int
378
- offset = min(size, (chunksUploaded * Client.chunkSize))
370
+ do {
371
+ let map = try await call(
372
+ method: "GET",
373
+ path: path + "/" + (params[idParamName!] as! String),
374
+ headers: headers,
375
+ params: [:],
376
+ converter: { return $0 }
377
+ )
378
+ let chunksUploaded = map["chunksUploaded"] as! Int
379
+ offset = min(size, (chunksUploaded * Client.chunkSize))
380
+ } catch {
381
+ // File does not exist yet, swallow exception
382
+ }
379
383
}
380
384
381
385
while offset < size {
You can’t perform that action at this time.
0 commit comments