diff --git a/YTKNetwork/YTKNetworkAgent.m b/YTKNetwork/YTKNetworkAgent.m index 5703013..a0ae14c 100644 --- a/YTKNetwork/YTKNetworkAgent.m +++ b/YTKNetwork/YTKNetworkAgent.m @@ -549,7 +549,10 @@ - (NSURL *)incompleteDownloadTempPathForDownloadPath:(NSString *)downloadPath { NSString *tempPath = nil; NSString *md5URLString = [YTKNetworkUtils md5StringFromString:downloadPath]; tempPath = [[self incompleteDownloadTempCacheFolder] stringByAppendingPathComponent:md5URLString]; - return [NSURL fileURLWithPath:tempPath]; + if (tempPath) { + return [NSURL fileURLWithPath:tempPath]; + } + return nil; } #pragma mark - Testing diff --git a/YTKNetwork/YTKNetworkPrivate.m b/YTKNetwork/YTKNetworkPrivate.m index 1bc62e1..200f2d2 100644 --- a/YTKNetwork/YTKNetworkPrivate.m +++ b/YTKNetwork/YTKNetworkPrivate.m @@ -92,6 +92,9 @@ + (BOOL)validateJSON:(id)json withValidator:(id)jsonValidator { } + (void)addDoNotBackupAttribute:(NSString *)path { + if (!path) { + return ; + } NSURL *url = [NSURL fileURLWithPath:path]; NSError *error = nil; [url setResourceValue:[NSNumber numberWithBool:YES] forKey:NSURLIsExcludedFromBackupKey error:&error];