Skip to content

Commit ed61397

Browse files
committed
Decrypt file info when restoring an e2e encrypted file, don't allow download of files with pending deletion
1 parent abd87b1 commit ed61397

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

internal/storage/FileServing.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ func isPendingToBeDeleted(file models.File, timeNow int64) bool {
774774
// or if the provided timestamp is after the expiry timestamp
775775
func IsExpiredFile(file models.File, timeNow int64) bool {
776776
return (file.ExpireAt < timeNow && !file.UnlimitedTime) ||
777-
(file.DownloadsRemaining < 1 && !file.UnlimitedDownloads)
777+
(file.DownloadsRemaining < 1 && !file.UnlimitedDownloads) || file.PendingDeletion != 0
778778
}
779779

780780
// isExpiredFileWithoutDownload returns true if there is no active download for an expired file

internal/webserver/web/static/js/admin_ui_upload.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,9 @@ function handleUndo(button) {
959959
apiFilesRestore(button.dataset.fileid)
960960
.then(data => {
961961
addRow(data.FileInfo);
962+
if (isE2EEnabled) {
963+
GokapiE2EDecryptMenu();
964+
}
962965
})
963966
.catch(error => {
964967
alert("Unable to restore file: " + error);

0 commit comments

Comments
 (0)