aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2024-02-28 16:06:16 +0100
committerLouis <louis@chmn.me>2024-02-29 21:32:28 +0100
commit66fbb7be761d5f1bc9613eff9fa749adec3dd40b (patch)
treed89dceedc6584b09caa99ec50e0be465a7574834
parent1e9f438d1af214b708dcc22a785eece54e218db4 (diff)
downloadnextcloud-server-66fbb7be761d5f1bc9613eff9fa749adec3dd40b.tar.gz
nextcloud-server-66fbb7be761d5f1bc9613eff9fa749adec3dd40b.zip
fix(files_versions): Do not create a new version for empty files
Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r--apps/files_versions/lib/Listener/FileEventsListener.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/apps/files_versions/lib/Listener/FileEventsListener.php b/apps/files_versions/lib/Listener/FileEventsListener.php
index f5def37fc9e..84cffc2c1fd 100644
--- a/apps/files_versions/lib/Listener/FileEventsListener.php
+++ b/apps/files_versions/lib/Listener/FileEventsListener.php
@@ -219,11 +219,12 @@ class FileEventsListener implements IEventListener {
}
if (
- ($writeHookInfo['versionCreated'] || $writeHookInfo['previousNode']->getSize() === 0) &&
+ $writeHookInfo['versionCreated'] &&
$node->getMTime() !== $writeHookInfo['previousNode']->getMTime()
) {
// If a new version was created, insert a version in the DB for the current content.
- // Unless both versions have the same mtime.
+ // If both versions have the same mtime, it means the latest version file simply got overrode,
+ // so no need to create a new version.
$this->created($node);
} else {
try {