umbraco / Umbraco.Deploy.Issues

1 stars 0 forks source link

Umbraco deploy generates inconsistent UDI - fails on OSX #153

Closed dealloc closed 1 year ago

dealloc commented 1 year ago

Umbraco Deploy v11.0.0 generates inconsistent UDI for stylesheets, which causes restore failures on OSX (though I'm assuming every platform that is not Windows is affected.

We created a rich text editor and linked a stylesheet to it, which generates the following UDA file:

{
  "Name": "Richtext Paragraph editor",
  "Alias": "",
  "EditorAlias": "Umbraco.TinyMCE",
  "DatabaseType": 0,
  "Configuration": {
    "editor": {
      "toolbar": [
        "..."
      ],
      "stylesheets": [
        "/css/styles/editor.css"
      ],
      "maxImageSize": 500,
      "mode": "classic"
    },
    "overlaySize": "small",
    "hideLabel": false,
    "ignoreUserStartNodes": false
  },
  "Parent": "umb://data-type-container/9547a64690634fb0be07ba626e7df8c8",
  "Udi": "umb://data-type/990a47623749499da3d5bf0e84577a91",
  "Dependencies": [
    {
      "Udi": "umb://data-type-container/9547a64690634fb0be07ba626e7df8c8",
      "Ordering": true,
      "Mode": 0
    },
    {
      "Udi": "umb://stylesheet/styles%5Ceditor.css",
      "Ordering": false,
      "Mode": 1
    }
  ],
  "__type": "Umbraco.Deploy.Infrastructure,Umbraco.Deploy.Infrastructure.Artifacts.DataTypeArtifact",
  "__version": "11.0.0"
}

Note specifically under Dependencies how the Udi key of the stylesheet has %5C in it, which is the URL encoded character of \. I'm assuming that Deploy generates the backslash since that's what Windows uses as a path separator, but all other UDI only contain forward slashes (as recommended by the URI RFC).

Interestingly enough it generates the correct path under the stylesheets key

      "stylesheets": [
        "/css/styles/editor.css"
      ],

Reproduction

If you're filing a bug, please describe how to reproduce it. Include as much relevant information as possible, such as:

Bug summary

TLDR: Deploy generates %5C instead of / when generating a UDI that's a physical path

Specifics

So far I've only seen this for rich text editors when adding a stylesheet, but I'm assuming it'll occur whenever Deploy generates a UDI for a path rather than a reference.

Steps to reproduce

Expected result

    {
-      "Udi": "umb://stylesheet/styles%5Ceditor.css",
+      "Udi": "umb://stylesheet/styles/editor.css",
      "Ordering": false,
      "Mode": 1
    }

I'd expect uniform, forward slashes for all UDI

Actual result

    {
+      "Udi": "umb://stylesheet/styles%5Ceditor.css",
      "Ordering": false,
      "Mode": 1
    }

Currently it generates backslashes which are encoded to %5C in the UDA files.

AndyButland commented 1 year ago

Thanks for the report, and I agree this looks wrong. Would you be able to share please specifically what issue this causes for a restore? I.e. are you getting an exception (and if so, can you share it)?

dealloc commented 1 year ago

my colleague is currently not available, but this gave us an error along the lines "contents are identical but checksums differ" in the web interface when trying to restore

AndyButland commented 1 year ago

I've created the above PR to the CMS repository, which is where I think this should be corrected, so we use / consistently for UDI paths as you suggest.

AndyButland commented 1 year ago

The above PR to the CMS has been merged now, so I'll close this issue. It'll be available in the next release of Umbraco 10 and 11.

ronaldbarendse commented 1 year ago

One thing to note (as mentioned on the CMS PR): after you've upgraded to Umbraco 10.4.1 (or higher), you will probably have to re-export all data types to ensure they use the forward slash and deploy those changes to all environments to ensure the checksums are also the same.

You can do this by triggering a Deploy export (from the back-office dashboard or creating the deploy-export trigger file) on the lowest environment (e.g. local or Development), committing the changes and deploying that to all environments. If you still get the 'checksums differ' error, you can remove the cached signatures/checksums on both source and destination environments (from the back-office dashboard or by creating the deploy-clearsignatures trigger file).