diff --git a/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java b/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java index c1c34c1ee286..b4b61bd76326 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -249,6 +249,19 @@ public OCFile findDuplicatedFile(OCFile parentFolder, ServerFileInterface newFil return duplicatedFile; } + public String getFileNameBasedOnEncryptionStatus(OCFile file) { + FileEntity entity = fileDao.getFileById(file.getFileId()); + if (entity == null) { + return file.getFileName(); + } + + if (file.isEncrypted()) { + return entity.getEncryptedName(); + } else { + return entity.getName(); + } + } + public List getFolderImages(OCFile folder, boolean onlyOnDevice) { List imageList = new ArrayList<>();