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

Syncing media with change file #254

Open
bielu opened this issue Dec 10, 2024 · 7 comments
Open

Syncing media with change file #254

bielu opened this issue Dec 10, 2024 · 7 comments

Comments

@bielu
Copy link

bielu commented Dec 10, 2024

Describe the bug
A clear and concise description of what the bug is.

Version (please complete the following information):

  • Umbraco Version: 13.5.2
  • uSync Version 13.2.5
  • uSync.Complete Version 13.1.8

To Reproduce
Steps to reproduce the behavior:

  1. Upload the file on Env1 test1.pdf
  2. Use in content and deploy the page and media files to env2 with uSync complete
  3. On the same media item in Umbraco on env1, remove the file and upload Test2.pdf
  4. Deploy the page and media files to env2 with uSync complete
  5. Notice that both urls to files test1.pdf and test2.pdf are still working, so file wasn't removed from blob storage.

Expected behavior
After syncing test1.pdf would be removed from blob storage

@KevinJump KevinJump reopened this Dec 10, 2024
@KevinJump
Copy link
Member

Yeah, i will check what this actually looks like in the code .

by default, we don't delete things, they go into the recycle bin, and umbraco doesn't remove things until the bin is empty.

However - I appreciate this is different so i will take a look.

@bielu
Copy link
Author

bielu commented Dec 10, 2024

@KevinJump the logic of removal of nodes is fine, there is the issue with removal of files attach, so yeah quite different, thanks for looking into it!

@bielu
Copy link
Author

bielu commented Jan 7, 2025

Hey @KevinJump so any idea if we can fix this?

@KevinJump
Copy link
Member

so TLDR: - Yes, we can fix this, (and have a working branch, and nightly build if you want to try it).

https://dev.azure.com/jumoo/Public/_artifacts/feed/nightly/NuGet/uSync.Complete/overview/13.1.9-20250108.1

its a bit complicated, because the core bits of uSync which track the changes don't know about media files (they just know about properties and file hash values). and uSync.Complete doesn't know much more than the key and file name of the things its pushing.

So - a bit hacky, we reach into the change details from the sync to get the old and new values of the umbracoFile property, we then extract the file source from that (often in a bit of json representing the cropper).

if the old and new source values are different, then we mark the old value for deletion and then after we have imported all the new files we remove these files .

I am, a little bit concerned that if this goes wrong for what ever reason we might remove media files that should be there, but i think it should be ok.

@KevinJump
Copy link
Member

what we might do is put this behind an option (which might well be on by default), so it can be turned off if it causes people issues.

@KevinJump
Copy link
Member

just tiding this up, we are going to have this off by default in v13 (don't want to issue a big breaking change to the 'stable' release.

"AllowDeletingOfRenamedMediaFiles"

e.g

"uSync": {
  "Publisher": {
    "Settings": {
      "IncomingEnabled": true,
      "AllowDeletingOfRenamedMediaFiles": true,
      "AppId": "[APP_ID]",
      "AppKey": "[APP_KEY]"
    }
  }
}

@bielu
Copy link
Author

bielu commented Jan 13, 2025

hey @KevinJump that's fine, i had opportunity to check it and all seems work as expected, awaiting the official build with new setting! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants