Commit graph

482 commits

Author SHA1 Message Date
Git'Fellow
c5fa862b06 fix(files_versions): Use helper function
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2025-08-28 21:24:52 +02:00
Ferdinand Thiessen
378ddda301
fix(files_versions): has-preview must be either true or false
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-08-07 01:24:07 +02:00
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 +02: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 +02: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 +02: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 +02: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 +02:00
Robin Appelman
aa15f9d16d
chore: run rector
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-07-01 22:45:52 +02: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 +02: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 +02: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 +02: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 +02: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 +02: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 +02: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 +02: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 +02:00
provokateurin
78a175fc74
refactor: Apply rector refactorings
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-05-14 15:29:02 +02: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 +02: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 +02: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 +02: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 +02: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 +02: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 +02:00
provokateurin
936166939c
feat(files_versions): Implement preview mime icon fallback
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-03-27 08:56:45 +01:00
provokateurin
89779808e0
fix(files_versions): Cache previews
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-03-27 08:56:45 +01: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 +01: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 +01: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 +00:00
Kostiantyn Miakshyn
9bba153e4f Fix: NotFoundException for anonymous users
Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
2025-02-21 18:24:11 +01: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 +01: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 +01: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 +01: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 +01: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 +01:00
provokateurin
085d4c9364
refactor(OpenAPI): Adjust scopes to match previous behavior
Signed-off-by: provokateurin <kate@provokateurin.de>
2025-01-06 14:30:40 +01:00
Louis Chemineau
f6c48a45ae
fix: Correctly create NonExistingFolder during copy
Signed-off-by: Louis Chemineau <louis@chmn.me>
2024-12-04 15:38:35 +01:00
provokateurin
77114fb327
fix(OpenAPI): Adjust array syntax to avoid ambiguities
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-11-05 09:58:11 +01:00
provokateurin
381077028a
refactor(apps): Use constructor property promotion when possible
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-10-21 12:37:59 +02: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 +02: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 +02: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 +02:00
provokateurin
dc13f9cc1e
fix(Files): Handle getOwner() returning false
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-17 10:10:50 +02: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 +02:00
John Molakvoæ
1fa9d3987b
Merge pull request #46887 from nextcloud/fix/versions-catch-insertion-error 2024-08-14 10:32:45 +02:00
Kate
1044b7f0b9
Merge pull request #46813 from nextcloud/refactor/files_versions/security-attributes 2024-08-14 09:46:46 +02: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 +02: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 +02: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 +02: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 +02: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 +02:00