Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • npack 42 posts 288 karma points
    Sep 10, 2024 @ 22:17
    npack
    0

    Is Preview Broken in v14?

    On both my v14 sites, when I click 'Save and Preview' I get sent to a page URL that ends with "&culture=invariant"

    This results in an error:

    CultureNotFoundException: Culture is not supported. (Parameter 'name') invariant is an invalid culture identifier.

    System.Globalization.CultureInfo.GetCultureInfo(string name)
    Umbraco.Cms.Web.Common.Localization.DynamicRequestCultureProviderBase.<DetermineProviderCultureResult>b__4_0(StringSegment culture)
    Umbraco.Cms.Web.Common.Localization.DynamicRequestCultureProviderBase.TryAddLocked(IEnumerable<CultureInfo> supportedCultures, IEnumerable<StringSegment> cultures, object locker, Action<StringSegment> addAction)
    Umbraco.Cms.Web.Common.Localization.DynamicRequestCultureProviderBase.DetermineProviderCultureResult(HttpContext httpContext)
    Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
    

    If I hand-edit the url to include a culture instead of the word 'invariant' then the page opens fine.

    I saw a couple other users here getting this error but their recent comments were buried at the bottom of an old post: https://our.umbraco.com/packages/backoffice-extensions/plumber-workflow-for-umbraco/plumber-workflow-for-umbraco-discussion-and-troubleshooting/108500-error-on-preview-culture-is-not-supported

    Is this a setting, appsetting, machine setting that I have wrong somehow? It is happening on a new single-language umbraco v14 install so it seems out of the box this way.

  • npack 42 posts 288 karma points
    Sep 10, 2024 @ 22:18
    npack
    0

    To clarify, I'm running 14.0.2

  • npack 42 posts 288 karma points
    28 days ago
    npack
    0

    Worked around this by adding intercepting and leap-frogging the 'Preview' iframe functionality based on an article https://adolfi.dev/blog/umbraco-preview/

    public class PreviewController : Controller
    {
        [HttpGet]
        [Route("umbraco/preview")]
        public IActionResult Index(string id)
        {
            var requestUrl = new Uri(Request.GetDisplayUrl());
            var leftPart = requestUrl.GetLeftPart(UriPartial.Authority);
            return new RedirectResult($"{leftPart}/{id}");
        }
    }
    

    and in appsettings.json Umbraco Globals

    "ReservedPaths": "~/umbraco/preview"
    

    This also resolved some CORS errors the iframe was introducing, and strips off the &culture=invariant querystring that was causing the error. The drawback is you don't get the different device sizes footer menu.

Please Sign in or register to post replies

Write your reply to:

Draft