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

Commit e578885

Browse files
committed
Refactored to use an inline lambda function
This follows the style that we've used to hook into the other events.
1 parent ec7c64b commit e578885

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/Our.Umbraco.DocTypeGridEditor/Bootstrap.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,15 @@ protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplica
6464
}
6565
};
6666

67-
PublishedContentRequest.Prepared += PublishedContentRequest_Prepared;
68-
}
69-
70-
private void PublishedContentRequest_Prepared(object sender, EventArgs e)
71-
{
72-
var request = sender as PublishedContentRequest;
73-
// Check if it's a dtgePreview request and is set to redirect.
74-
// If so reset the redirect url to an empty string to stop the redirect happening in preview mode.
75-
if (request.Uri.Query.Contains("dtgePreview") && request.IsRedirect)
67+
PublishedContentRequest.Prepared += (sender, e) =>
7668
{
77-
request.SetRedirect(string.Empty);
78-
}
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+
};
7976
}
8077
}
8178
}

0 commit comments

Comments
 (0)