Skip to content
This repository was archived by the owner on Feb 10, 2024. It is now read-only.

Commit 91971a3

Browse files
authored
Merge pull request #78 from designagencyuk/develop
Fix issue with umbracoRedirect and dtgePreview
2 parents 7a282c6 + e578885 commit 91971a3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Our.Umbraco.DocTypeGridEditor/Bootstrap.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Umbraco.Core;
77
using Umbraco.Core.Sync;
88
using Umbraco.Web.Cache;
9+
using Umbraco.Web.Routing;
910

1011
namespace Our.Umbraco.DocTypeGridEditor
1112
{
@@ -62,6 +63,16 @@ protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplica
6263
}
6364
}
6465
};
66+
67+
PublishedContentRequest.Prepared += (sender, e) =>
68+
{
69+
// Check if it's a dtgePreview request and is set to redirect.
70+
// If so reset the redirect url to an empty string to stop the redirect happening in preview mode.
71+
if (sender is PublishedContentRequest request && request.Uri.Query.InvariantContains("dtgePreview") && request.IsRedirect)
72+
{
73+
request.SetRedirect(string.Empty);
74+
}
75+
};
6576
}
6677
}
6778
}

0 commit comments

Comments
 (0)