Skip to content

Commit 889058f

Browse files
Fix issue in hasUploadedFile() (#1693)
1 parent 0c3b2af commit 889058f

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

base/src/main/java/com/smartdevicelink/managers/file/BaseFileManager.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,17 @@ public void run() {
271271
*/
272272
public boolean hasUploadedFile(@NonNull SdlFile file) {
273273
// HAX: [#827](https://github.com/smartdevicelink/sdl_ios/issues/827) Older versions of Core had a bug where list files would cache incorrectly.
274-
if (file.isPersistent() && mutableRemoteFileNames != null && mutableRemoteFileNames.contains(file.getName())) {
275-
// If it's a persistent file, the bug won't present itself; just check if it's on the remote system
276-
return true;
277-
} else if (!file.isPersistent() && mutableRemoteFileNames != null && mutableRemoteFileNames.contains(file.getName()) && uploadedEphemeralFileNames.contains(file.getName())) {
278-
// If it's an ephemeral file, the bug will present itself; check that it's a remote file AND that we've uploaded it this session
274+
Version rpcVersion = new Version(internalInterface.getSdlMsgVersion());
275+
if (new Version(4, 4, 0).isNewerThan(rpcVersion) == 1) {
276+
if (file.isPersistent() && mutableRemoteFileNames != null && mutableRemoteFileNames.contains(file.getName())) {
277+
// HAX: If it's a persistent file, the bug won't present itself; just check if it's on the remote system
278+
return true;
279+
} else if (!file.isPersistent() && mutableRemoteFileNames != null && mutableRemoteFileNames.contains(file.getName()) && uploadedEphemeralFileNames.contains(file.getName())) {
280+
// HAX: If it's an ephemeral file, the bug will present itself; check that it's a remote file AND that we've uploaded it this session
281+
return true;
282+
}
283+
} else if (mutableRemoteFileNames != null && mutableRemoteFileNames.contains(file.getName())) {
284+
// If not connected to a system where the bug presents itself, we can trust the `remoteFileNames`
279285
return true;
280286
}
281287
return false;

0 commit comments

Comments
 (0)