skybrud / Skybrud.Umbraco.Redirects.Import

Import and export addon for Skybrud.Umbraco.Redirects.
MIT License
7 stars 11 forks source link

URL Redirects #15

Closed Rhoyo closed 1 year ago

Rhoyo commented 1 year ago

Hey I was trying out your imports package and created a test redirect which I exported to another environment in order to test out the functionality of the package.

I received this issue.

/test-page Destination URL is not a valid URL: https://www.nyan.cat/ Object reference not set to an instance of an object.

This was the line in the csv file:

Id Key RootKey Url QueryString DestinationType DestinationId DestinationKey DestinationUrl DestinationQuery DestinationFragment Type ForwardQueryString CreateDate UpdateDate 1 cc80c591-d034-4307-866c-5bd20d3ee6f6 00000000-0000-0000-0000-000000000000 /test-page Url 0 00000000-0000-0000-0000-000000000000 https://www.nyan.cat/ Permanent False 2023-09-28T19:53:52.783-10:00 2023-09-28T20:12:37.637-10:00

Furthermore I am seeing that redirects to outside URLs should be handled in your file: https://github.com/skybrud/Skybrud.Umbraco.Redirects.Import/blob/a8566c10ba2f03ed6e7835131049d8ccc4206205/src/Skybrud.Umbraco.Redirects.Import/RedirectsImportHelper.cs#L519

Here on line 519:

        } else if (!destinationUrl.StartsWith("http://") && !destinationUrl.StartsWith("https://")) {
            item.Errors.Add($"Destination URL is not a valid URL: {destinationUrl}");
            return;
        }

Any help would be appreciated to why this doesn't work.

Redirects_20230928201700.csv

abjerner commented 1 year ago

Hi @Rhoyo

Did you figure out a solution to your issue since you've closed the issue again?

I tried testing out your CSV file, and the redirect is imported successfully with default options for the CSV importer, so it correctly detects that you've used space as a separator.

Rhoyo commented 1 year ago

@abjerner

Yes I figured it out, thank you for replying quickly. After further research and inspection, it appeared that I should just use the correct version. I was on alpha001 where after checking the version bugs and fixes logs a higher version of the package handled the error, after doing so I installed alpha004.

Thank you again, you've been great at replying quickly to my questions.

abjerner commented 1 year ago

@Rhoyo good to hear that it worked out for you 👍

Just by closing the issue I would still be a bit in the dark about whether there was or still is an issue. So thanks for clarifying that 😉

Anyways, I'm not sure what your install/upgrade process is, but if you're on alpha004, you're still two releases behind. There is also a alpha005, but more importantly a v4.0.0 stable release:

https://github.com/skybrud/Skybrud.Umbraco.Redirects.Import/releases/tag/v4.0.0