Commit Graph

480 Commits (b9ab00a59e2d906fdb43eaaea37eb7a4a9cc8a13)

Author SHA1 Message Date
Borja Domínguez Vázquez d0de83be10
feat(file-versions): #53151 add VersionCreatedEvent event
Signed-off-by: Borja Domínguez Vázquez <bdominguez@virtualwareco.com>
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-07-29 14:05:21 +07:00
Borja Domínguez Vázquez cdeed5bcbe chore: get revision for a node
Signed-off-by: Borja Domínguez Vázquez <borja.dominguez@hotmail.com>
Signed-off-by: Borja Domínguez Vázquez <iam.n3uro@gmail.com>

wip

Signed-off-by: Borja Domínguez Vázquez <borja.dominguez@hotmail.com>
Signed-off-by: Borja Domínguez Vázquez <iam.n3uro@gmail.com>

wip

Signed-off-by: Borja Domínguez Vázquez <borja.dominguez@hotmail.com>
Signed-off-by: Borja Domínguez Vázquez <iam.n3uro@gmail.com>

Update IVersionBackend.php

Signed-off-by: Borja Domínguez Vázquez <iam.n3uro@gmail.com>

wip
2025-07-07 14:30:29 +07:00
Borja Domínguez Vázquez 676fb4014d chore: use constants for metadata
Signed-off-by: Borja Domínguez Vázquez <borja.dominguez@hotmail.com>
2025-07-05 22:38:08 +07:00
Arthur Schiwon 38a8546bd6
Merge pull request #52963 from nextcloud/fix/avoid-crashing-versions-listener-on-non-existing-file
fix(files_versions): Log error instead of crashing when event listeners get called on non-existing files
2025-07-03 15:21:25 +07:00
Arthur Schiwon cbc573f787
Merge pull request #53276 from nextcloud/fix/log-failure-from-file-events
fix(files_versions): Log failure to compute node path
2025-07-03 09:45:37 +07:00
Robin Appelman aa15f9d16d
chore: run rector
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-07-01 22:45:52 +07:00
Côme Chilliet 5c0e8df427 fix(files_versions): Log error instead of crashing when event listeners get called on non-existing files
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-07-01 16:40:57 +07:00
Ferdinand Thiessen 5981b7eb51
chore: apply new CSFixer rules
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>

# Conflicts:
#	apps/settings/lib/SetupChecks/PhpOpcacheSetup.php
2025-07-01 16:26:50 +07:00
Côme Chilliet 15c8b5ac58
chore: Use an if/else instead of the try/catch to make meaning more obvious
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-17 16:25:45 +07:00
Côme Chilliet 7f1fb65549
fix(files_versions): Log failure to compute node path
To avoid hidden bugs, add some debug logging when a node path cannot be
 computed from a received event, to have more information for debugging

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-06-03 09:35:23 +07:00
Ferdinand Thiessen 2dcadd2603
fix(files_versions): only close stream if still open, fixing S3
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-05-18 16:48:56 +07:00
Ferdinand Thiessen 0f69648d0a
fix(files_version): use `Storage::writeStream` instead of deprecated `streamCopy` if possible
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-05-16 17:28:24 +07:00
Ferdinand Thiessen 01db539d0a
chore: move streamCopy implementation from `OC_Helper` to `OCP\Files`
The function was already there but called the legacy version.
So moved the implementation and migrated all usages of it.
Sadly the interface was slightly different so adjusted it to be
compatible with both legacy and the OCP one.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-05-16 13:03:05 +07:00
Côme Chilliet 2cd491f491
Merge pull request #48560 from nextcloud/fix/migrate-encryption-away-from-hooks
feat(encryption): Migrate from hooks to events
2025-05-14 19:25:51 +07:00
provokateurin 78a175fc74
refactor: Apply rector refactorings
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-05-14 15:29:02 +07:00
Côme Chilliet 536ccf144c feat(encryption): Migrate from hooks to events
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-05-13 23:37:52 +07:00
Git'Fellow 1b549d4943 fix(files_versions): Folder should not be hardcoed
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2025-05-09 09:35:17 +07:00
Ferdinand Thiessen 9df998e710
Merge pull request #52369 from nextcloud/fix/files-versions-author
fix(files_versions): wait for version to be created before setting metadata
2025-04-29 11:01:58 +07:00
Ferdinand Thiessen 8ca23f2c7d
fix(files_versions): only handle path updates when there is path
`getPathForNode` can fail with null for various reasons (e.g. no owner),
in this cases we need to just skip the event handling.

Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-04-27 23:51:56 +07:00
Ferdinand Thiessen 5e03c6fb58
fix(files_versions): create version if previous does not exist
This issue happens reproducible if:
- Versions is disabled
- Upload a file
- Enable versions
- Upload same file unchanged
- Now the error happens.

Problem is that the mtime is unchanged so no version will be created on the upload, but it tries to update the last version which does not exists.
Instead of "upload same file unchanged" you can also - like in the example stack trace above - use Android with an SD card with invalid mtime -> the mtime will be stripped so its always the same.
Instead of disable versions the same also happens if e.g. the versions creation failed due to other issues.

The solution now is to catch the exception and create if not exists.
A cleaner solution would be to have a method on the versions backend
like `hasVersionEntity(File $file, int $revision): bool` but this would
be a breaking change or at least a feature that apps need to implement.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-04-23 16:03:20 +07:00
Ferdinand Thiessen 2020760f88
fix(files_versions): wait for version to be created before setting metadata
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-04-23 13:09:43 +07:00
provokateurin 936166939c
feat(files_versions): Implement preview mime icon fallback
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-03-27 08:56:45 +07:00
provokateurin 89779808e0
fix(files_versions): Cache previews
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-03-27 08:56:45 +07:00
Stephan Orbaugh ef099806a4
Merge pull request #50990 from AIlkiv/refactor/version-rollback-to-event
refactor: move version rollback hook to event
2025-02-27 15:03:37 +07:00
Louis 9682ef7025
Merge pull request #50903 from nextcloud/artonge/fix/min_age_rentention_files_versions
fix(files_versions): Do not expire versions newer than min age
2025-02-25 16:01:05 +07:00
ailkiv 9b3424f607 refactor: move version rollback hook to event
Signed-off-by: ailkiv <a.ilkiv.ye@gmail.com>
2025-02-25 14:03:21 +07:00
Kostiantyn Miakshyn 9bba153e4f Fix: NotFoundException for anonymous users
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
2025-02-21 18:24:11 +07:00
Louis Chemineau 4561a0a870 fix(files_versions): Do not expire versions newer than min age
The auto expire logic does not take into account the min retention age set by the admin. So versions were eagerly deleted.

Fix https://github.com/nextcloud/server/issues/19791

Signed-off-by: Louis Chemineau <louis@chmn.me>
2025-02-19 12:25:09 +07:00
Côme Chilliet 64863c9d46
chore: Apply new rector configuration to apps folder
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-02-13 11:46:42 +07:00
Côme Chilliet f758f565d4
fix: Replace getInstalledApps calls with getEnabledApps
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-02-13 10:19:20 +07:00
Louis Chemineau c87db7a960 fix(files_versions): Update `unencrypted_size` during rollback
This prevent restored version of encrypted files from having a wrong reported size. This was blocking download.

Signed-off-by: Louis Chemineau <louis@chmn.me>
2025-01-28 15:28:34 +07:00
Louis Chemineau 5336c92ca5 chore(files_versions): Remove unused $node variable
Signed-off-by: Louis Chemineau <louis@chmn.me>
2025-01-28 15:28:34 +07:00
provokateurin 085d4c9364
refactor(OpenAPI): Adjust scopes to match previous behavior
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-01-06 14:30:40 +07:00
Louis Chemineau f6c48a45ae
fix: Correctly create NonExistingFolder during copy
Signed-off-by: Louis Chemineau <louis@chmn.me>
2024-12-04 15:38:35 +07:00
provokateurin 77114fb327
fix(OpenAPI): Adjust array syntax to avoid ambiguities
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-11-05 09:58:11 +07:00
provokateurin 381077028a
refactor(apps): Use constructor property promotion when possible
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-10-21 12:37:59 +07:00
Côme Chilliet 1580c8612b
chore(apps): Apply new rector configuration to autouse classes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-10-15 10:40:25 +07:00
Côme Chilliet 1a4978c4ea
chore: Apply rector configuration to apps folder
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-09-20 17:51:00 +07:00
provokateurin 9836e9b164
chore(deps): Update nextcloud/coding-standard to v1.3.1
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-19 14:21:20 +07:00
provokateurin dc13f9cc1e
fix(Files): Handle getOwner() returning false
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-17 10:10:50 +07:00
Daniel Kesselberg af6de04e9e
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2024-08-25 19:34:58 +07:00
John Molakvoæ 1fa9d3987b
Merge pull request #46887 from nextcloud/fix/versions-catch-insertion-error 2024-08-14 10:32:45 +07:00
Kate 1044b7f0b9
Merge pull request #46813 from nextcloud/refactor/files_versions/security-attributes 2024-08-14 09:46:46 +07:00
Ferdinand Thiessen 4bbcbc5206
feat: Make `ISharedStorage` public API and reuse where possible
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-08-12 11:42:10 +07:00
Stephan Orbaugh 199ee80795
Merge pull request #46710 from nextcloud/artonge/fix/use_timestamp_instead_of_revision
fix: Use timestamp instead of revision id in files_versions metadata API
2024-08-06 15:00:41 +07:00
Côme Chilliet 30a2e8f9b8
fix(files_versions): Catch constraint error on version insertion
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-07-30 17:09:10 +07:00
provokateurin 2c8f6a009a
refactor(files_versions): Replace security annotations with respective attributes
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-07-27 21:34:00 +07:00
greta 26d22881e5 fix: add a try and catch for delete versioning
Signed-off-by: greta <gretadoci@gmail.com>
2024-07-25 14:46:06 +07:00
carhe 7eac3fe7da fix(files_versions): avoid unintentional skipping of expiration
Signed-off-by: carhe <carstenherrmann@web.de>
2024-07-25 12:29:04 +07:00
Louis Chemineau 6e76aed867
fix: Use timestamp instead of revision id in files_versions metadata API
Signed-off-by: Louis Chemineau <louis@chmn.me>
2024-07-24 09:34:13 +07:00