aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions/lib
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2024-02-28 16:06:16 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-03-01 09:14:07 +0000
commit68fcbbd31c940f99bab37ce80ad89a1e43fabb03 (patch)
treed15ce64596ec3858dd817d7140ba4c50251dfbf3 /apps/files_versions/lib
parent94e8727af33a1a54960d5ae097220af48582664f (diff)
downloadnextcloud-server-68fcbbd31c940f99bab37ce80ad89a1e43fabb03.tar.gz
nextcloud-server-68fcbbd31c940f99bab37ce80ad89a1e43fabb03.zip
fix(files_versions): Do not create a new version for empty files
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps/files_versions/lib')
-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 206c75ec6ec..f199d47b981 100644
--- a/apps/files_versions/lib/Listener/FileEventsListener.php
+++ b/apps/files_versions/lib/Listener/FileEventsListener.php
@@ -218,11 +218,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 {