Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong timestamp of file versions #2055

Closed
XueSheng-GIT opened this issue Aug 9, 2022 · 4 comments
Closed

Wrong timestamp of file versions #2055

XueSheng-GIT opened this issue Aug 9, 2022 · 4 comments
Labels
0. Needs triage Issues that need to be triaged bug

Comments

@XueSheng-GIT
Copy link

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

Follow up of #1901 (first part of this issue).

  1. Create a file in a groupfolder (e. g. nextcloud office odt) and add some text (this is the initial file version)
  2. Open the file after some time and add some more text (this is the second file version).
  3. Open details of file (side bar) to check activity and file versions

Expected behaviour

File version of the initial file version should be shown with the date (timestamp) of this initial version. Generally file versioning should work in the same way as outside of a groupfolder.

Actual behaviour

File version of the initial file is shown but with date (timestamp) of the second file version (which is irritating and misleading).
Behaviour outside of a groupfolder does work as expected.

Server configuration

Operating system: Ubuntu 20.04

Web server: apache 2

Database: mysql/myriadb

PHP version: 7.4.3

Nextcloud version: 24.0.4 rc1

Group folders version: 12.0.1 with patched #2047

Updated from an older Nextcloud/ownCloud or fresh install: Updated

Where did you install Nextcloud from: Official repo

Are you using external storage, if yes which one: not as part of groupfolders

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Firefox

Operating system: Ubuntu 22.04

@XueSheng-GIT XueSheng-GIT added 0. Needs triage Issues that need to be triaged bug labels Aug 9, 2022
@XueSheng-GIT
Copy link
Author

Adding some screenshots demonstrating the above described steps. Same steps done for the file inside/outside the groupfolder. activity and version details shown.

File versioning inside groupfolder:
Inside groupfolder (activity)
Inside groupfolder (version)

File versioning outside groupfolder:
Outside groupfolder (activity)
Outside groupfolder (version)

@XueSheng-GIT
Copy link
Author

XueSheng-GIT commented Sep 1, 2022

I'm not a programmer, but just had a look at the code. It seems the following line is responsible for creation of the version with the current timestamp. Using the current timestamp makes actually no sense, because the version is related to the already existing file, thus the timestamp of the existing file must be used.

$revision = $this->timeFactory->getTime();

Not sure how to get the timestamp of the existing file (which is copied as version). Just using the modification time seems to do the trick on the first view. But could also be wrong!?

$revision = $file->getMTime();

@XueSheng-GIT
Copy link
Author

Modification time of restored file must also be updated during rollback (this is also done for the local storage). Possible fix posted here:
#2077 (comment)

Maybe someone with deeper knowledge to versioning wants to test/double check.

@XueSheng-GIT
Copy link
Author

This was finally fixed with #2543

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Issues that need to be triaged bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant