umbraco / Umbraco.Packages

The online home of the Umbraco Package team
https://our.umbraco.com/get-involved/the-package-team/
12 stars 29 forks source link

Can't rename a package #44

Closed nul800sebastiaan closed 4 years ago

nul800sebastiaan commented 5 years ago

As a package developer it's currently not possible to rename a package after it's been created.

Note: after a rename, there should be an automatic redirect from the old to the new URL.

jmayntzhusen commented 4 years ago

Hmm it's a bit weird, the spot it creates or saves updates to a package it doesn't set the name on update only on initial save.

If we add a line here: https://github.com/umbraco/OurUmbraco/blob/master/OurUmbraco/MarketPlace/NodeListing/NodeListingProvider.cs#L152

content.Name = listingItem.Name;

It will actually update the name for the package if you set a new one in the title field where you edit packages: image

It will be saved and the redirect will automatically be made as well.

Before the search result reflects the name change a projectIndex reindexing needs to happen.

However I also found that a few of the packages I tested with would lead to a YSOD page when it tries to save the node with the contentService:

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_umbracoRedirectUrl". The conflict occurred in database "OurDevAnon", table "dbo.umbracoNode", column 'uniqueID'.
The statement has been terminated.

However after navigating away from the ysod page the package would still be updated and the redirect url would work..

Haven't gotten around to checking the db to see what causes this..