Skip to content

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

Merged
artonge merged 2 commits intomasterfrom
artonge/fix/copy_cache_during_copy_operations
Dec 4, 2024
Merged

fix(files): Correctly copy the cache information during copy operations#48651
artonge merged 2 commits intomasterfrom
artonge/fix/copy_cache_during_copy_operations

Conversation

@artonge
Copy link
Copy Markdown
Collaborator

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator 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 <louis@chmn.me>
@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 <louis@chmn.me>
@artonge artonge merged commit 27331d4 into master Dec 4, 2024
@artonge artonge deleted the artonge/fix/copy_cache_during_copy_operations branch December 4, 2024 15:58
@icewind1991
Copy link
Copy Markdown
Member

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

@kyteinsky
Copy link
Copy Markdown
Contributor

hello, was this backported to 29/30? Would you mind helping me with the links?

@joshtrichards
Copy link
Copy Markdown
Member

hello, was this backported to 29/30? Would you mind helping me with the links?

No, it was not.

@nfebe
Copy link
Copy Markdown
Contributor

nfebe commented Feb 13, 2025

/backport to stable30

@nfebe
Copy link
Copy Markdown
Contributor

nfebe commented Feb 13, 2025

/backport to stable29

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.

6 participants