diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2021-09-22 14:22:53 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2021-09-22 14:22:53 -0400 |
commit | bbe5454aa88168c25fbc956e79832ebc63177330 (patch) | |
tree | e1e5db106d9bfef74d872ff333c74f01c01ecf23 | |
parent | 09e5e226d01ed512cec25e10de379fcbb5235440 (diff) | |
download | sdl_ios-bbe5454aa88168c25fbc956e79832ebc63177330.tar.gz |
Fix SDLFile copying
-rw-r--r-- | SmartDeviceLink/public/SDLFile.m | 13 | ||||
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLPreloadPresentChoicesOperationSpec.m | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/SmartDeviceLink/public/SDLFile.m b/SmartDeviceLink/public/SDLFile.m index b3efaf200..89b8042b4 100644 --- a/SmartDeviceLink/public/SDLFile.m +++ b/SmartDeviceLink/public/SDLFile.m @@ -161,7 +161,18 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - NSCopying - (id)copyWithZone:(nullable NSZone *)zone { - return [[self.class allocWithZone:zone] initWithFileURL:_fileURL name:_name persistent:_persistent]; + SDLFile *fileCopy = [[self.class allocWithZone:zone] init]; + fileCopy.name = _name.copy; + fileCopy.fileURL = _fileURL.copy; + fileCopy.fileType = _fileType.copy; + fileCopy.persistent = _persistent; + fileCopy.isStaticIcon = _isStaticIcon; + + if (_data.length == 0 && _fileURL != nil) { + fileCopy.data = _data.copy; + } + + return fileCopy; } #pragma mark - NSObject overrides diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLPreloadPresentChoicesOperationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLPreloadPresentChoicesOperationSpec.m index 45e4b7efc..dfb910a99 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLPreloadPresentChoicesOperationSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLPreloadPresentChoicesOperationSpec.m @@ -293,7 +293,7 @@ describe(@"a preload choices operation", ^{ }); }); - fcontext(@"when artworks are not already on the system", ^{ + context(@"when artworks are not already on the system", ^{ beforeEach(^{ OCMStub([testFileManager hasUploadedFile:[OCMArg isNotNil]]).andReturn(NO); }); |