Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
🐛🍎 Issue #156: [iOS] - Requesting an resource with the same id does n…
Browse files Browse the repository at this point in the history
…ot replace the resource by default
  • Loading branch information
macdonst committed Dec 13, 2016
1 parent 47c5d0e commit 2c3f236
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ios/ContentSync.m
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ - (void) URLSession:(NSURLSession*)session downloadTask:(NSURLSessionDownloadTas
if(success) {
NSLog(@"Moving %@ to %@", [srcURL path], [dstURL path]);

if([fileManager fileExistsAtPath:[dstURL path]]) {
NSLog(@"%@ already exists. Deleting it since type is set to `replace`", [dstURL path]);
[fileManager removeItemAtURL:dstURL error:NULL];
}

success = [fileManager moveItemAtURL:srcURL toURL:dstURL error:&errorCopy];
if(!success) {
NSLog(@"Error copying. File might already exist %@", [errorCopy description]);
Expand Down

0 comments on commit 2c3f236

Please sign in to comment.