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

fix(files): Correctly copy the cache information during copy operations #48651

Merged
merged 2 commits into from
Dec 4, 2024

Conversation

artonge
Copy link
Contributor

@artonge artonge commented Oct 10, 2024

Needed to copy the encrypted flag of encrypted files when those files are two level down in a moved folder.

Reproduction steps of the issue:

  • Set up the following folder structure
    • /A/B/t.txt
    • /C
  • Copy A in C
  • t.txt is encrypted but does not have the encrypted flag set to true, and therefore not readable.

With this PR, t.txt is readable.

Note: Open to better ways to share code between the two methods.

Added a test to ensure file content stays the same after a copy.

@artonge artonge added bug 3. to review Waiting for reviews feature: encryption (server-side) feature: files php Pull requests that update Php code labels Oct 10, 2024
@artonge artonge added this to the Nextcloud 31 milestone Oct 10, 2024
@artonge artonge self-assigned this Oct 10, 2024
@artonge artonge force-pushed the artonge/fix/copy_cache_during_copy_operations branch from 9411fc1 to eb3c214 Compare October 10, 2024 16:33
@joshtrichards
Copy link
Member

This might help with #48174.

@artonge artonge force-pushed the artonge/fix/copy_cache_during_copy_operations branch from eb3c214 to b5fbe77 Compare October 14, 2024 09:50
Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of 🐘 , I do not understand what’s going on here

@artonge artonge force-pushed the artonge/fix/copy_cache_during_copy_operations branch from b5fbe77 to 6a0e117 Compare October 14, 2024 13:39
@artonge artonge changed the title fix(files): Correctly copy the cache information on copy operations fix(files): Correctly copy the cache information during copy operations Oct 14, 2024
@artonge
Copy link
Contributor Author

artonge commented Oct 15, 2024

Snap, the ObjectStoreStorage does the cache copy inside the storage copy, so the final cache copy creates another filecache entry.

$targetId = $cache->copyFromCache($cache, $sourceEntry, $to);

Edit: maybe this part can be improved:

if ($this->cache->inCache($target)) {
$this->cache->remove($target);
}

@artonge artonge force-pushed the artonge/fix/copy_cache_during_copy_operations branch from f45c8ed to d050233 Compare October 21, 2024 11:59
@artonge artonge force-pushed the artonge/fix/copy_cache_during_copy_operations branch 7 times, most recently from 2bde182 to fd0ef41 Compare December 3, 2024 15:40
Needed to copy the `encrypted` flag of encrypted files when those files are two level down in a moved folder.

Signed-off-by: Louis Chemineau <[email protected]>
@artonge artonge force-pushed the artonge/fix/copy_cache_during_copy_operations branch from fd0ef41 to 199b0bd Compare December 3, 2024 16:04
Signed-off-by: Louis Chemineau <[email protected]>
@artonge artonge merged commit 27331d4 into master Dec 4, 2024
188 checks passed
@artonge artonge deleted the artonge/fix/copy_cache_during_copy_operations branch December 4, 2024 15:58
@icewind1991
Copy link
Member

This introduced a regression for some cross-storage moves, see #49695

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug feature: encryption (server-side) feature: files php Pull requests that update Php code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants