Skip to content

Commit 3e9ff6b

Browse files
committed
Check we have matched a preview URL by ID when exiting preview. (#18841)
1 parent fdca086 commit 3e9ff6b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/Umbraco.Web.BackOffice/Controllers/PreviewController.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,8 @@ public ActionResult End(string? redir = null)
217217

218218
// are we attempting a redirect to the default route (by ID with optional culture)?
219219
Match match = DefaultPreviewRedirectRegex().Match(redir ?? string.Empty);
220-
if (match.Success)
220+
if (match.Success && int.TryParse(match.Groups["id"].Value, out int id))
221221
{
222-
var id = int.Parse(match.Groups["id"].Value);
223-
224222
// first try to resolve the published URL
225223
if (_umbracoContextAccessor.TryGetUmbracoContext(out IUmbracoContext? umbracoContext) &&
226224
umbracoContext.Content is not null)

0 commit comments

Comments
 (0)