Jumoo / uSync.Complete.Issues

Public Issue tracker and roadmap for uSync.Complete
https://jumoo.co.uk/usync/complete/
2 stars 1 forks source link

Exporter media sync packs with UmbracoMediaPath don't import the file #202

Closed ianleeder closed 1 year ago

ianleeder commented 1 year ago

Describe the bug If using a custom media path (UmbracoMediaPath), exported media does not allow importing the actual media file. An entry is created in the Media section, but no media (eg image) file exists.

Version (please complete the following information):

To Reproduce Steps to reproduce the behavior:

  1. In appsettings.json set the UmbracoMediaPath:
    "Umbraco": {
      "CMS": {
        "Global": {
          "UmbracoMediaPath": "~/mypath/media"
        }
      }
    }
  2. Upload an image to media.
    • Verify the file is available on the specified media path URL, eg /mypath/media/ci4hulet/commander-keen.png
  3. Go to Settings, uSync, Exporter.
    • Ensure 'Include Media files' is checked.
    • Select Media, select the new image.
    • Disable Dependecies, Children, Ancestors.
    • Click Create to generate and download a sync pack. image
  4. Go back to the Media section
    • Delete the file entry.
    • Empty the recycle bin.
    • Ensure the file is deleted from the local drive, eg /wwwroot/mypath/media/ci4hulet/commander-keen.png
  5. Go to Settings, uSync, Exporter.
    • Import the sync pack created in step 3.

Expected behavior The source file should be imported.
Instead, the Media entry is created, but the source file is missing.

Screenshots image

ianleeder commented 1 year ago

I've inspected the contents of the pack file zip, and have been unable to determine a reason for this. Debug logging has not highlighted anything obvious, apart from a couple of missing lines, specifically

[16:17:36 DBG] file path from property: /media/mmynyjps/commander-keen.png

Here is a log dump of a failed import:

[16:12:52 DBG] Handler PartialFileHandler is in the disabled handler list
[16:12:52 DBG] Handler PartialMacroFileHandler is in the disabled handler list
[16:12:52 DBG] Handler ScriptFileHandler is in the disabled handler list
[16:12:52 DBG] Handler StyleSheetHandler is in the disabled handler list
[16:12:52 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:12:52 DBG] Handler MediaFileHandler is in the disabled handler list
[16:12:52 DBG] Handler PartialFileHandler is in the disabled handler list
[16:12:52 DBG] Handler PartialMacroFileHandler is in the disabled handler list
[16:12:52 DBG] Handler ScriptFileHandler is in the disabled handler list
[16:12:52 DBG] Handler StyleSheetHandler is in the disabled handler list
[16:12:52 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:12:52 DBG] Handler MediaFileHandler is in the disabled handler list
[16:13:01 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:13:10 DBG] Unpack Export: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\933e9831-2763-4551-9da7-9f7def390cdd\ja2fsmek.xrm.usync
[16:13:10 DBG] Unzip: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\933e9831-2763-4551-9da7-9f7def390cdd\ja2fsmek.xrm.usync 3 Entries to [C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\933e9831-2763-4551-9da7-9f7def390cdd]
[16:13:11 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:13:11 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:13:11 DBG] Saving File: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\933e9831-2763-4551-9da7-9f7def390cdd\_actions.config [1579]
[16:13:11 DBG] Saving File: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\933e9831-2763-4551-9da7-9f7def390cdd\_media.config [40]
[16:13:11 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:13:11 DBG] Saving File: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\933e9831-2763-4551-9da7-9f7def390cdd\_files_changes.config [2]
[16:13:11 DBG] Saving File: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\933e9831-2763-4551-9da7-9f7def390cdd\_files_changes.config [2]
[16:13:13 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:13:13 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:13:13 DBG] Base: Deserializing Media
[16:13:13 DBG] Find Parent failed, will search by path /MyPathKeen
[16:13:13 DBG] Parent not found in the path
[16:13:13 DBG] Unable to find parent but parent node is set in configuration
[16:13:13 DBG] 0 Setting Path -1,0 was
[16:13:13 DBG] 0 Setting Level to 1 was 0
[16:13:13 DBG] 0 Setting CreateDate: 06/06/2023 16:01:43
[16:13:13 DBG] Property [0] MyPath Keen set umbracoFile value
[16:13:13 DBG] Loaded MediaHandler from publisher
[16:13:13 DBG] Base: Deserialize Core Success Media
[16:13:13 DBG] Saving File: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\933e9831-2763-4551-9da7-9f7def390cdd\_actions.config [644]
[16:13:13 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:13:13 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:13:13 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:13:13 DBG] Saving File: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\933e9831-2763-4551-9da7-9f7def390cdd\_actions.config [644]
[16:13:13 DBG] Saving File: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\933e9831-2763-4551-9da7-9f7def390cdd\_actions.config [644]
[16:13:18 DBG] Handler ContentHandler is in the disabled handler list
[16:13:18 DBG] Handler ContentTemplateHandler is in the disabled handler list
[16:13:21 DBG] Handler ContentHandler is in the disabled handler list
[16:13:21 DBG] Handler ContentTemplateHandler is in the disabled handler list
[16:13:23 DBG] Handler ContentHandler is in the disabled handler list
[16:13:23 DBG] Handler ContentTemplateHandler is in the disabled handler list

And this is a successful import

[16:17:17 DBG] Handler PartialFileHandler is in the disabled handler list
[16:17:17 DBG] Handler PartialMacroFileHandler is in the disabled handler list
[16:17:17 DBG] Handler ScriptFileHandler is in the disabled handler list
[16:17:17 DBG] Handler StyleSheetHandler is in the disabled handler list
[16:17:17 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:17:17 DBG] Handler MediaFileHandler is in the disabled handler list
[16:17:17 DBG] Handler PartialFileHandler is in the disabled handler list
[16:17:17 DBG] Handler PartialMacroFileHandler is in the disabled handler list
[16:17:17 DBG] Handler ScriptFileHandler is in the disabled handler list
[16:17:17 DBG] Handler StyleSheetHandler is in the disabled handler list
[16:17:17 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:17:17 DBG] Handler MediaFileHandler is in the disabled handler list
[16:17:22 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:17:31 DBG] Unpack Export: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\81dfdaed-6391-4aea-af3b-30c2f5485f98\orzbcn5z.bk3.usync
[16:17:31 DBG] Unzip: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\81dfdaed-6391-4aea-af3b-30c2f5485f98\orzbcn5z.bk3.usync 3 Entries to [C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\81dfdaed-6391-4aea-af3b-30c2f5485f98]
[16:17:31 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:17:31 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:17:32 DBG] Saving File: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\81dfdaed-6391-4aea-af3b-30c2f5485f98\_actions.config [1607]
[16:17:32 DBG] Saving File: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\81dfdaed-6391-4aea-af3b-30c2f5485f98\_media.config [40]
[16:17:32 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:17:32 DBG] Saving File: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\81dfdaed-6391-4aea-af3b-30c2f5485f98\_files_changes.config [2]
[16:17:32 DBG] Saving File: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\81dfdaed-6391-4aea-af3b-30c2f5485f98\_files_changes.config [2]
[16:17:36 DBG] RestoreMediaFile: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\81dfdaed-6391-4aea-af3b-30c2f5485f98, C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\81dfdaed-6391-4aea-af3b-30c2f5485f98\media\mmynyjps\efab89289045474b952d9798285ac08e.png
[16:17:36 DBG] file path from property: /media/mmynyjps/commander-keen.png
[16:17:36 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:17:36 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:17:36 DBG] Base: Deserializing Media
[16:17:36 DBG] Find Parent failed, will search by path /keen_without_mediapath
[16:17:36 DBG] Parent not found in the path
[16:17:36 DBG] Unable to find parent but parent node is set in configuration
[16:17:36 DBG] 0 Setting Path -1,0 was
[16:17:36 DBG] 0 Setting Level to 1 was 0
[16:17:36 DBG] 0 Setting CreateDate: 06/06/2023 15:04:20
[16:17:36 DBG] Property [0] keen_without_mediapath set umbracoFile value
[16:17:36 DBG] Loaded MediaHandler from publisher
[16:17:36 DBG] Base: Deserialize Core Success Media
[16:17:36 DBG] Saving File: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\81dfdaed-6391-4aea-af3b-30c2f5485f98\_actions.config [648]
[16:17:36 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:17:36 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:17:36 DBG] Handler PublishedContentHandler is in the disabled handler list
[16:17:36 DBG] Saving File: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\81dfdaed-6391-4aea-af3b-30c2f5485f98\_actions.config [648]
[16:17:36 DBG] Saving File: C:\Users\IanLeeder\AppData\Local\Temp\UmbracoData\f1ef9c4eb82aeeb98546d2b73bc1a5087b09aa10\uSync\exports\81dfdaed-6391-4aea-af3b-30c2f5485f98\_actions.config [648]

I would be more concerned about the entry Handler MediaFileHandler is in the disabled handler list if it didn't work, but that entry shows on a successful import too. AFAIK I haven't done any specific uSync config regarding handlers.

KevinJump commented 1 year ago

Hi,

Yeah I suspect its probably the part where we make the media location generic again (e.g /media) but then don't put it back properly.

We will take a look and see.

KevinJump commented 1 year ago

Hi, we have a fix for this now. and will wrap it up in the next release (this week).

ianleeder commented 1 year ago

Woah, can't knock the service here! Thanks for the speedy turnaround.
Quick question @KevinJump, was the error on the export side, or the import? I'm not sure how supported this is, but I'm trying to export from 8 and import into 10.

KevinJump commented 1 year ago

Hi,

Its actually a bit of both, (for v10 anyway) - generally uSync makes things generic to help move them, but we weren't replacing the UmbracoMediaPath value with /media on export and then doing the opposite at the other end.

So the files will be in a sync pack just in the wrong place and on import they will likely make it to disk, against just into an incorrect folder - (usually with an extra /media on them - so `mypath/media/media' )

if that's true - the quick fix is to move the media files on disk (if you can). to the correct folder - and they should appear in the backoffice.

KevinJump commented 1 year ago

Closing in 10.6 and 11.2 releases