aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2025-05-12 13:17:26 +0200
committerGitHub <noreply@github.com>2025-05-12 13:17:26 +0200
commit768b101a9d4e371d9fcb5611113f7c23c77ddd81 (patch)
tree52a45b968d3c0acc4cb267c33079c1da6b539731 /lib/private
parente6bdfcd8eda4ffbf4cc4b056326bd20220518b56 (diff)
parentd9c53ef748350de0c5a229fa2d8aef0cd038e568 (diff)
downloadnextcloud-server-768b101a9d4e371d9fcb5611113f7c23c77ddd81.tar.gz
nextcloud-server-768b101a9d4e371d9fcb5611113f7c23c77ddd81.zip
Merge pull request #52706 from nextcloud/info-file-more-encryption-checks
feat: add more encryption checks to info:file
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Files/Storage/Wrapper/Encryption.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php
index 0de009f0894..bdaba57687a 100644
--- a/lib/private/Files/Storage/Wrapper/Encryption.php
+++ b/lib/private/Files/Storage/Wrapper/Encryption.php
@@ -905,4 +905,16 @@ class Encryption extends Wrapper {
public function setEnabled(bool $enabled): void {
$this->enabled = $enabled;
}
+
+ /**
+ * Check if the on-disk data for a file has a valid encrypted header
+ *
+ * @param string $path
+ * @return bool
+ */
+ public function hasValidHeader(string $path): bool {
+ $firstBlock = $this->readFirstBlock($path);
+ $header = $this->util->parseRawHeader($firstBlock);
+ return (count($header) > 0);
+ }
}