Skip to content

Commit 37343b2

Browse files
Merge branch 'contrib' into v15/dev
2 parents aaa025f + fd9c1a0 commit 37343b2

File tree

10 files changed

+58
-127
lines changed

10 files changed

+58
-127
lines changed

src/Umbraco.Cms.StaticAssets/umbraco/UmbracoBackOffice/Index.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<base href="@backOfficePath.EnsureEndsWith('/')" />
2929
<link rel="icon" type="image/svg+xml" href="@backOfficeAssetsPath/assets/favicon.svg" />
3030
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
31-
<meta name="apple-mobile-web-app-capable" content="yes"/>
31+
<meta name="mobile-web-app-capable" content="yes"/>
3232
<meta name="robots" content="noindex, nofollow"/>
3333
<meta name="pinterest" content="nopin"/>
3434
<title>Umbraco</title>

src/Umbraco.Cms.StaticAssets/umbraco/UmbracoLogin/Index.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<base href="@backOfficePath.EnsureEndsWith('/')"/>
4141
<link rel="icon" type="image/svg+xml" href="~/umbraco/login/favicon.svg"/>
4242
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
43-
<meta name="apple-mobile-web-app-capable" content="yes"/>
43+
<meta name="mobile-web-app-capable" content="yes"/>
4444
<meta name="robots" content="noindex, nofollow"/>
4545
<meta name="pinterest" content="nopin"/>
4646
<title>Umbraco</title>

src/Umbraco.Web.Common/DependencyInjection/UmbracoBuilderExtensions.cs

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Data.Common;
22
using System.Net.Http.Headers;
33
using System.Reflection;
4+
using System.Runtime.CompilerServices;
45
using Microsoft.AspNetCore.Builder;
56
using Microsoft.AspNetCore.DataProtection.Infrastructure;
67
using Microsoft.AspNetCore.Hosting;
@@ -326,23 +327,40 @@ public static IUmbracoBuilder AddHelpers(this IUmbracoBuilder builder)
326327
return builder;
327328
}
328329

329-
// TODO: Does this need to exist and/or be public?
330+
[Obsolete("This is not necessary any more. This will be removed in v16")]
330331
public static IUmbracoBuilder AddWebServer(this IUmbracoBuilder builder)
331332
{
332-
// TODO: We need to figure out why this is needed and fix those endpoints to not need them, we don't want to change global things
333-
// If using Kestrel: https://stackoverflow.com/a/55196057
334333
builder.Services.Configure<KestrelServerOptions>(options =>
335334
{
336335
options.AllowSynchronousIO = true;
337336
});
338-
builder.Services.Configure<IISServerOptions>(options =>
339-
{
340-
options.AllowSynchronousIO = true;
341-
});
342337

338+
try
339+
{
340+
// See https://github.com/umbraco/Umbraco-CMS/pull/17886. This is a workaround for non-windows machines
341+
// they won't have IIS available and trying to set this option will throw an exception.
342+
//
343+
// We're deferring this call to a method because if we just try to set the options here, we still get a
344+
// TypeLoadException on non-windows machines.
345+
// This workaround came from this comment: https://stackoverflow.com/a/3346975
346+
AllowSynchronousIOForIIS(builder);
347+
}
348+
catch (TypeLoadException)
349+
{
350+
// Ignoring this exception because it's expected on non-windows machines
351+
}
343352
return builder;
344353
}
345354

355+
// Prevents the compiler from inlining the method
356+
[MethodImpl(MethodImplOptions.NoInlining)]
357+
private static void AllowSynchronousIOForIIS(IUmbracoBuilder builder) =>
358+
builder.Services.Configure<IISServerOptions>(
359+
options =>
360+
{
361+
options.AllowSynchronousIO = true;
362+
});
363+
346364
private static IProfiler GetWebProfiler(IConfiguration config, IHttpContextAccessor httpContextAccessor)
347365
{
348366
var isDebug = config.GetValue<bool>($"{Constants.Configuration.ConfigHosting}:Debug");

src/Umbraco.Web.Common/Routing/UmbracoVirtualPageRoute.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
using Microsoft.AspNetCore.Mvc.Filters;
66
using Microsoft.AspNetCore.Routing;
77
using Microsoft.Extensions.DependencyInjection;
8+
using Umbraco.Cms.Core.DependencyInjection;
89
using Umbraco.Cms.Core.Models.PublishedContent;
910
using Umbraco.Cms.Core.Routing;
11+
using Umbraco.Cms.Core.Web;
1012
using Umbraco.Cms.Web.Common.Controllers;
1113
using Umbraco.Cms.Web.Common.Extensions;
1214

@@ -21,6 +23,7 @@ public class UmbracoVirtualPageRoute : IUmbracoVirtualPageRoute
2123
private readonly LinkParser _linkParser;
2224
private readonly UriUtility _uriUtility;
2325
private readonly IPublishedRouter _publishedRouter;
26+
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
2427

2528
/// <summary>
2629
/// Constructor.
@@ -29,16 +32,29 @@ public class UmbracoVirtualPageRoute : IUmbracoVirtualPageRoute
2932
/// <param name="linkParser">The link parser.</param>
3033
/// <param name="uriUtility">The Uri utility.</param>
3134
/// <param name="publishedRouter">The published router.</param>
35+
/// <param name="umbracoContextAccessor">The umbraco context accessor.</param>
3236
public UmbracoVirtualPageRoute(
3337
EndpointDataSource endpointDataSource,
3438
LinkParser linkParser,
3539
UriUtility uriUtility,
36-
IPublishedRouter publishedRouter)
40+
IPublishedRouter publishedRouter,
41+
IUmbracoContextAccessor umbracoContextAccessor)
3742
{
3843
_endpointDataSource = endpointDataSource;
3944
_linkParser = linkParser;
4045
_uriUtility = uriUtility;
4146
_publishedRouter = publishedRouter;
47+
_umbracoContextAccessor = umbracoContextAccessor;
48+
}
49+
50+
[Obsolete("Please use constructor that takes an IUmbracoContextAccessor instead, scheduled for removal in v17")]
51+
public UmbracoVirtualPageRoute(
52+
EndpointDataSource endpointDataSource,
53+
LinkParser linkParser,
54+
UriUtility uriUtility,
55+
IPublishedRouter publishedRouter)
56+
: this(endpointDataSource, linkParser, uriUtility, publishedRouter, StaticServiceProvider.Instance.GetRequiredService<IUmbracoContextAccessor>())
57+
{
4258
}
4359

4460
/// <summary>
@@ -157,7 +173,8 @@ public async Task<IPublishedRequest> CreatePublishedRequest(HttpContext httpCont
157173
requestBuilder.SetPublishedContent(publishedContent);
158174
_publishedRouter.RouteDomain(requestBuilder);
159175

160-
return requestBuilder.Build();
176+
// Ensure the culture and domain is set correctly for the published request
177+
return await _publishedRouter.RouteRequestAsync(requestBuilder, new RouteRequestOptions(Core.Routing.RouteDirection.Inbound));
161178
}
162179

163180
/// <summary>
@@ -171,6 +188,12 @@ public async Task SetRouteValues(HttpContext httpContext, IPublishedContent publ
171188
{
172189
IPublishedRequest publishedRequest = await CreatePublishedRequest(httpContext, publishedContent);
173190

191+
// Ensure the published request is set to the UmbracoContext
192+
if (_umbracoContextAccessor.TryGetUmbracoContext(out IUmbracoContext? umbracoContext))
193+
{
194+
umbracoContext.PublishedRequest = publishedRequest;
195+
}
196+
174197
var umbracoRouteValues = new UmbracoRouteValues(
175198
publishedRequest,
176199
controllerActionDescriptor);

src/Umbraco.Web.UI.Login/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<base href="/"/>
66
<link rel="icon" type="image/svg+xml" href="/favicon.svg"/>
77
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
8-
<meta name="apple-mobile-web-app-capable" content="yes"/>
8+
<meta name="mobile-web-app-capable" content="yes"/>
99
<meta name="robots" content="noindex, nofollow"/>
1010
<meta name="pinterest" content="nopin"/>
1111
<title>Umbraco</title>

src/Umbraco.Web/HealthCheck/Checks/Security/UmbracoApplicationUrlCheck.cs

Lines changed: 0 additions & 109 deletions
This file was deleted.

templates/UmbracoExtension/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
* Use VSCode as the editor of choice as it has good tooling support for TypeScript and it will recommend a VSCode Extension for good Lit WebComponent completions
3636

3737
== Other Resources ==
38-
* Umbraco Docs - https://docs.umbraco.com/umbraco-cms/customizing/extend-and-customize-editing-experience
38+
* Umbraco Docs - https://docs.umbraco.com/umbraco-cms/customizing/overview

tests/Umbraco.Tests.Common/Builders/ContentTypeEditingBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public static ContentTypeCreateModel CreateContentTypeWithContentPicker(string a
192192
.Build();
193193
}
194194

195-
public static ContentTypeCreateModel CreateContentTypeWithTwoPropertiesOneVariantAndOneInvariant(string alias = "test", string name = "TestName", string variantPropertyAlias = "variant", string variantPropertyName = "Variant", string invariantAlias = "invariant", string invariantName = "Invariant")
195+
public static ContentTypeCreateModel CreateContentTypeWithTwoPropertiesOneVariantAndOneInvariant(string alias = "test", string name = "TestName", string variantPropertyAlias = "variant", string variantPropertyName = "Variant", string invariantAlias = "invariant", string invariantName = "Invariant")
196196
{
197197
var containerKey = Guid.NewGuid();
198198
var builder = new ContentTypeEditingBuilder();

tests/Umbraco.Tests.Common/TestHelperBase.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ public IScopeProvider ScopeProvider
9696
Mock.Of<IMediaPathScheme>(),
9797
loggerFactory.CreateLogger<MediaFileManager>(),
9898
Mock.Of<IShortStringHelper>(),
99-
Mock.Of<IServiceProvider>(),
100-
Options.Create(new ContentSettings()));
99+
Mock.Of<IServiceProvider>());
101100
var databaseFactory = new Mock<IUmbracoDatabaseFactory>();
102101
var database = new Mock<IUmbracoDatabase>();
103102
var sqlContext = new Mock<ISqlContext>();
@@ -207,7 +206,7 @@ public virtual string MapPathForTestFiles(string relativePath)
207206
throw new ArgumentException("relativePath must start with '~/'", nameof(relativePath));
208207
}
209208

210-
var codeBase = typeof(TestHelperBase).Assembly.CodeBase;
209+
var codeBase = typeof(TestHelperBase).Assembly.Location;
211210
var uri = new Uri(codeBase);
212211
var path = uri.LocalPath;
213212
var bin = Path.GetDirectoryName(path);

tests/Umbraco.Tests.Common/TestLastChanceFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ namespace Umbraco.Cms.Tests.Common;
88

99
public class TestLastChanceFinder : IContentLastChanceFinder
1010
{
11-
public async Task<bool> TryFindContent(IPublishedRequestBuilder frequest) => false;
11+
public Task<bool> TryFindContent(IPublishedRequestBuilder frequest) => Task.FromResult(false);
1212
}

0 commit comments

Comments
 (0)