Skip to content

Commit 1c60a82

Browse files
committed
fix(share): secure file drop
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent c52ae6f commit 1c60a82

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,21 @@ public void refreshSharesFromDB() {
613613
}
614614

615615
private void addExternalAndPublicShares(List<OCShare> externalShares) {
616-
final var publicShares = fileDataStorageManager.getSharesByPathAndType(file.getRemotePath(), ShareType.PUBLIC_LINK, "");
616+
final var publicShares = fileDataStorageManager.getSharesByPathAndType(
617+
file.getRemotePath(), ShareType.PUBLIC_LINK, "");
617618
externalShareeListAdapter.removeAll();
618619
final var shares = OCShareExtensionsKt.mergeDistinctByToken(externalShares, publicShares);
620+
621+
boolean hasNoSecureFileDrop = shares.stream()
622+
.noneMatch(s -> s.getShareType() == ShareType.PUBLIC_LINK
623+
|| s.getShareType() == ShareType.NEW_PUBLIC_LINK);
624+
625+
if (file.isEncrypted() && hasNoSecureFileDrop) {
626+
OCShare placeholder = new OCShare();
627+
placeholder.setShareType(ShareType.NEW_PUBLIC_LINK);
628+
shares.add(placeholder);
629+
}
630+
619631
externalShareeListAdapter.addShares(shares);
620632
}
621633

0 commit comments

Comments
 (0)