diff --git a/Vienna/Sources/Download window/DownloadManager.m b/Vienna/Sources/Download window/DownloadManager.m index eddf4258b9..d68efcc0ca 100644 --- a/Vienna/Sources/Download window/DownloadManager.m +++ b/Vienna/Sources/Download window/DownloadManager.m @@ -322,10 +322,19 @@ - (void)URLSession:(NSURLSession *)session didFinishDownloadingToURL:(NSURL *)location { dispatch_sync(dispatch_get_main_queue(), ^{ DownloadItem *item = [self itemForSessionTask:downloadTask]; - [NSFileManager.defaultManager moveItemAtURL:location - toURL:item.fileURL - error:nil]; - item.state = DownloadStateCompleted; + NSError *error; + BOOL success = [NSFileManager.defaultManager moveItemAtURL:location + toURL:item.fileURL + error:&error]; + if (success) { + item.state = DownloadStateCompleted; + } else { + item.state = DownloadStateFailed; + if (error.code == NSFileWriteNoPermissionError) { + // TODO: Implement error reporting + NSLog(@"%@", error.localizedDescription); + } + } [self deliverNotificationForDownloadItem:item]; }); }