Files
Umbraco-CMS/src/Umbraco.Core/Routing/NewDefaultUrlProvider.cs

313 lines
11 KiB
C#
Raw Normal View History

using System.Globalization;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PublishedCache;
using Umbraco.Cms.Core.Services;
V15: Remove Nucache (#17166) * Remove nucache reference from Web.Common * Get tests building-ish * Move ReservedFieldNamesService to the right project * Remove IPublishedSnapshotStatus * Added functionality to the INavigationQueryService to get root keys * Fixed issue with navigation * Remove IPublishedSnapshot from UmbracoContext * Begin removing usage of IPublishedSnapshot from PublishedContentExtensions * Fix PublishedContentExtensions.cs * Don't use snapshots in delivery media api * Use IPublishedMediaCache in QueryMediaApiController * Remove more usages of IPublishedSnapshotAccessor * Comment out tests * Remove more usages of PublishedSnapshotAccessor * Remove PublishedSnapshot from property * Fixed test build * Fix errors * Fix some tests * Delete NuCache 🎉 * Implement DatabaseCacheRebuilder * Remove usage of IPublishedSnapshotService * Remove IPublishedSnapshotService * Remove TestPublishedSnapshotAccessor and make tests build * Don't test Snapshot cachelevel It's no longer supported * Fix BlockEditorConverter Element != Element document type * Remember to set cachemanager * Fix RichTextParserTests * Implement TryGetLevel on INavigationQueryService * Fake level and obsolete it in PublishedContent * Remove ChildrenForAllCultures * Hack Path property on PublishedContent * Remove usages of IPublishedSnapshot in tests * More ConvertersTests * Add hybrid cache to integration tests We can actually do this now because we no longer save files on disk * Rename IPublishedSnapshotRebuilder to ICacheRebuilder * Comment out tests * V15: Replacing the usages of Parent (navigation data) from IPublishedContent (#17125) * Fix .Parent references in PublishedContentExtensions * Add missing methods to FriendlyPublishedContentExtensions (ones that you were able to call on the content directly as they now require extra params) * Fix references from the extension methods * Fix dependencies in tests * Replace IPublishedSnapshotAccessor with the content cache in tests * Resolving more .Parent references * Fix unit tests * Obsolete and use extension methods * Remove private method and use extension instead * Moving code around * Fix tests * Fix more references * Cleanup * Fix more usages * Resolve merge conflict * Fix tests * Cleanup * Fix more tests * Fixed unit tests * Cleanup * Replace last usages --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk> * Remove usage of IPublishedSnapshotAccessor from IRequestItemProvider * Post merge fixup * Remo IPublishedSnapshot * Add HasAny to IDocumentUrlService * Fix TextBuilder * Fix modelsbuilder tests * Use explicit types * Implement GetByContentType * Support element types in PublishedContentTypeCache * Run enlistments before publishing notifications * Fix elements cache refreshing * Implement GetByUdi * Implement GetAtRoot * Implement GetByRoute * Reimplement GetRouteById * Fix blocks unit tests * Initialize domain cache on boot * Only return routes with domains on non default lanauges * V15: Replacing the usages of `Children` (navigation data) from `IPublishedContent` (#17159) * Update params in PublishedContentExtensions to the general interfaces for the published cache and navigation service, so that we can use the extension methods on both documents and media * Introduce GetParent() which uses the right services * Fix obsolete message on .Parent * Obsolete .Children * Fix usages of Children for ApiMediaQueryService * Fix usage in internal * Fix usages in views * Fix indentation * Fix issue with delete language * Update nuget pacakges * Clear elements cache when content is deleted instead of trying to update it * Reset publishedModelFactory * Fixed publishing --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk> Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Co-authored-by: kjac <kja@umbraco.dk>
2024-10-01 15:03:02 +02:00
using Umbraco.Cms.Core.Services.Navigation;
using Umbraco.Cms.Core.Web;
using Umbraco.Extensions;
namespace Umbraco.Cms.Core.Routing;
/// <summary>
/// Provides URLs.
/// </summary>
public class NewDefaultUrlProvider : IUrlProvider
{
private readonly IPublishedContentCache _publishedContentCache;
private readonly IDomainCache _domainCache;
private readonly IIdKeyMap _idKeyMap;
private readonly IDocumentUrlService _documentUrlService;
V15: Remove Nucache (#17166) * Remove nucache reference from Web.Common * Get tests building-ish * Move ReservedFieldNamesService to the right project * Remove IPublishedSnapshotStatus * Added functionality to the INavigationQueryService to get root keys * Fixed issue with navigation * Remove IPublishedSnapshot from UmbracoContext * Begin removing usage of IPublishedSnapshot from PublishedContentExtensions * Fix PublishedContentExtensions.cs * Don't use snapshots in delivery media api * Use IPublishedMediaCache in QueryMediaApiController * Remove more usages of IPublishedSnapshotAccessor * Comment out tests * Remove more usages of PublishedSnapshotAccessor * Remove PublishedSnapshot from property * Fixed test build * Fix errors * Fix some tests * Delete NuCache 🎉 * Implement DatabaseCacheRebuilder * Remove usage of IPublishedSnapshotService * Remove IPublishedSnapshotService * Remove TestPublishedSnapshotAccessor and make tests build * Don't test Snapshot cachelevel It's no longer supported * Fix BlockEditorConverter Element != Element document type * Remember to set cachemanager * Fix RichTextParserTests * Implement TryGetLevel on INavigationQueryService * Fake level and obsolete it in PublishedContent * Remove ChildrenForAllCultures * Hack Path property on PublishedContent * Remove usages of IPublishedSnapshot in tests * More ConvertersTests * Add hybrid cache to integration tests We can actually do this now because we no longer save files on disk * Rename IPublishedSnapshotRebuilder to ICacheRebuilder * Comment out tests * V15: Replacing the usages of Parent (navigation data) from IPublishedContent (#17125) * Fix .Parent references in PublishedContentExtensions * Add missing methods to FriendlyPublishedContentExtensions (ones that you were able to call on the content directly as they now require extra params) * Fix references from the extension methods * Fix dependencies in tests * Replace IPublishedSnapshotAccessor with the content cache in tests * Resolving more .Parent references * Fix unit tests * Obsolete and use extension methods * Remove private method and use extension instead * Moving code around * Fix tests * Fix more references * Cleanup * Fix more usages * Resolve merge conflict * Fix tests * Cleanup * Fix more tests * Fixed unit tests * Cleanup * Replace last usages --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk> * Remove usage of IPublishedSnapshotAccessor from IRequestItemProvider * Post merge fixup * Remo IPublishedSnapshot * Add HasAny to IDocumentUrlService * Fix TextBuilder * Fix modelsbuilder tests * Use explicit types * Implement GetByContentType * Support element types in PublishedContentTypeCache * Run enlistments before publishing notifications * Fix elements cache refreshing * Implement GetByUdi * Implement GetAtRoot * Implement GetByRoute * Reimplement GetRouteById * Fix blocks unit tests * Initialize domain cache on boot * Only return routes with domains on non default lanauges * V15: Replacing the usages of `Children` (navigation data) from `IPublishedContent` (#17159) * Update params in PublishedContentExtensions to the general interfaces for the published cache and navigation service, so that we can use the extension methods on both documents and media * Introduce GetParent() which uses the right services * Fix obsolete message on .Parent * Obsolete .Children * Fix usages of Children for ApiMediaQueryService * Fix usage in internal * Fix usages in views * Fix indentation * Fix issue with delete language * Update nuget pacakges * Clear elements cache when content is deleted instead of trying to update it * Reset publishedModelFactory * Fixed publishing --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk> Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Co-authored-by: kjac <kja@umbraco.dk>
2024-10-01 15:03:02 +02:00
private readonly IDocumentNavigationQueryService _navigationQueryService;
private readonly IPublishedContentStatusFilteringService _publishedContentStatusFilteringService;
Serverside generated preview URLs (#20021) * Serverside generated preview URLs * Add URL provider notation to UrlInfo * Change preview URL generation to happen at preview time based on provider alias * Update XML docs * Always add culture (if available) to preview URL * Do not log user input (security vulnerability) * Fix typo * Re-generate TypeScript client from Management API * Deprecated `UmbDocumentPreviewRepository.enter()` (for v19) Fixed TS errors Added temp stub for `getPreviewUrl` * Adds `previewOption` extension-type * Adds "default" `previewOption` kind * Relocated "Save and Preview" workspace action reworked using the "default" `previewOption` kind. * Added stub for "urlProvider" `previewOption` kind * Renamed "workspace-action-default-kind.element.ts" to a more suitable filename. Exported element so can be reused in other packages, e.g. documents, for the new "save and preview" feature. * Refactored "Save and Preview" button to work with first action's manifest/API. * Reverted `previewOption` extension-type Re-engineered to make a "urlProvider" kind for `workspaceActionMenuItem`. This is to simplify the extension point and surrounding logic. * Modified `saveAndPreview` Document Workspace Context to accept a URL Provider Alias. * Refactored "Save and Preview" button to extend `UmbWorkspaceActionElement`. This did mean exposing certain methods/properties to be overridable. * Used `umbPeekError` to surface any errors to the user * Renamed `urlProvider` kind to `previewOption` * Relocated `urlProviderAlias` inside the `meta` property * also throw an error * Added missing `await` * Fix build errors after forward merge --------- Co-authored-by: leekelleher <leekelleher@gmail.com> Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Co-authored-by: Laura Neto <12862535+lauraneto@users.noreply.github.com>
2025-10-08 08:27:01 +02:00
private readonly ILogger<NewDefaultUrlProvider> _logger;
private readonly ISiteDomainMapper _siteDomainMapper;
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
private readonly UriUtility _uriUtility;
private RequestHandlerSettings _requestSettings;
private readonly ILanguageService _languageService;
V17 - Removing obsoleted code from Umbraco.Core (#20009) * Removing obsoleted code from ApiMediaQueryService.cs * Removing obsoleted code from ApiRichTextMarkupParserTests.cs * Removing obsoleted code from ContentCacheRefresher.cs * Removing obsoleted code from ContentFinderByUrlAlias.cs and adjusting its tests to use the new logic * Removing obsoleted code from ContentFinderByUrl.cs & its dependencies * Removing obsoleted code from ApiRichTextMarkupParserTests.cs * Removing obsoleted code from DocumentCache.cs & its dependencies * Removing obsoleted code from MediaCache.cs & its dependencies * Removing obsoleted code from PublishedCacheBase.cs & its dependencies * Removing obsoleted code from RenderNoContentController.cs and its tests * Removing obsoleted code from UmbracoRouteValueTransformer.cs * Removing obsoleted constructors from DefaultUrlProvider.cs * Removing accidental bookmark * Introducing a helper method to get the root keys in ApiMediaQueryService.cs * Removing obsoleted code from Cache classes * Removing unused imports * Refactoring to meet the CR * Added attribute to controller * Fixing missing using statement * Removing obsoleted constructor from ExternalLoginService.cs and making usages fit * Removing obsoleted method from IContentTypeFilter.cs * Removing obsoleted methods from IContentEditingService.cs * Removing obosoleted code from DocumentUrlService.cs * Removed obsoleted code from DataTypeService.cs * Removed obsoleted code from PublishStatusService.cs * Removing obsoleted code from the IContentPublishingService.cs and its dependencies. Also implementing a TODO in the service implementation * Removing obsoleted code from IRelationService.cs * Removing obsoleted code from ContentPublishingService.cs * Removing obsoleted code from ContentEditingService.cs * Removing obsoleted code from Constants-DataTypes.cs * Removing obsoleted code from IAction.cs and its implementations * Removing obsoleted code from IContentService.cs * Removing obsoleted code from DomainUtilities.cs * Removing obsoleted code from IIndexedEntitySearchService.cs and dependencies * Removing obsoleted code from UrlProvider.cs * Removing obsoleted code from AliasUrlProvider.cs * Removing obsoleted code from ApiContentRouteBuilder.cs * Removing obsoleted code from ApiPublishedContentCache.cs * Removing obsoleted class TemplateQueryResult.cs * Removing obsoleted code from ApiContentBuilder.cs * Removing obsoleted code from HealthCheck.cs * Removing obsoleted code from ContentTypeEditingService.cs * Removing obsoleted code from NewDefaultUrlProvider.cs * Removing obsoleted code from PublishedElementPropertyBase.cs * Removing obsoleted code from WebhookRequestService.cs * Bumping to obsolete in V18, due to usage in class that will be removed in V18 * Removing obsoleted code from PropertyValidationService.cs * Removing obsoleted code from AddUnroutableContentWarningsWhenPublishingNotificationHandler.cs * Removing obsoleted code from IMemberService.cs * Removing obsoleted code from DocumentCache.cs
2025-08-28 12:09:59 +02:00
// TODO See if we can make GetUrlFromRoute asynchronous and avoid the GetAwaiter().GetResult() in when using ILanguageService.
/// <summary>
/// Initializes a new instance of the <see cref="NewDefaultUrlProvider"/> class.
/// </summary>
V15: Remove Nucache (#17166) * Remove nucache reference from Web.Common * Get tests building-ish * Move ReservedFieldNamesService to the right project * Remove IPublishedSnapshotStatus * Added functionality to the INavigationQueryService to get root keys * Fixed issue with navigation * Remove IPublishedSnapshot from UmbracoContext * Begin removing usage of IPublishedSnapshot from PublishedContentExtensions * Fix PublishedContentExtensions.cs * Don't use snapshots in delivery media api * Use IPublishedMediaCache in QueryMediaApiController * Remove more usages of IPublishedSnapshotAccessor * Comment out tests * Remove more usages of PublishedSnapshotAccessor * Remove PublishedSnapshot from property * Fixed test build * Fix errors * Fix some tests * Delete NuCache 🎉 * Implement DatabaseCacheRebuilder * Remove usage of IPublishedSnapshotService * Remove IPublishedSnapshotService * Remove TestPublishedSnapshotAccessor and make tests build * Don't test Snapshot cachelevel It's no longer supported * Fix BlockEditorConverter Element != Element document type * Remember to set cachemanager * Fix RichTextParserTests * Implement TryGetLevel on INavigationQueryService * Fake level and obsolete it in PublishedContent * Remove ChildrenForAllCultures * Hack Path property on PublishedContent * Remove usages of IPublishedSnapshot in tests * More ConvertersTests * Add hybrid cache to integration tests We can actually do this now because we no longer save files on disk * Rename IPublishedSnapshotRebuilder to ICacheRebuilder * Comment out tests * V15: Replacing the usages of Parent (navigation data) from IPublishedContent (#17125) * Fix .Parent references in PublishedContentExtensions * Add missing methods to FriendlyPublishedContentExtensions (ones that you were able to call on the content directly as they now require extra params) * Fix references from the extension methods * Fix dependencies in tests * Replace IPublishedSnapshotAccessor with the content cache in tests * Resolving more .Parent references * Fix unit tests * Obsolete and use extension methods * Remove private method and use extension instead * Moving code around * Fix tests * Fix more references * Cleanup * Fix more usages * Resolve merge conflict * Fix tests * Cleanup * Fix more tests * Fixed unit tests * Cleanup * Replace last usages --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk> * Remove usage of IPublishedSnapshotAccessor from IRequestItemProvider * Post merge fixup * Remo IPublishedSnapshot * Add HasAny to IDocumentUrlService * Fix TextBuilder * Fix modelsbuilder tests * Use explicit types * Implement GetByContentType * Support element types in PublishedContentTypeCache * Run enlistments before publishing notifications * Fix elements cache refreshing * Implement GetByUdi * Implement GetAtRoot * Implement GetByRoute * Reimplement GetRouteById * Fix blocks unit tests * Initialize domain cache on boot * Only return routes with domains on non default lanauges * V15: Replacing the usages of `Children` (navigation data) from `IPublishedContent` (#17159) * Update params in PublishedContentExtensions to the general interfaces for the published cache and navigation service, so that we can use the extension methods on both documents and media * Introduce GetParent() which uses the right services * Fix obsolete message on .Parent * Obsolete .Children * Fix usages of Children for ApiMediaQueryService * Fix usage in internal * Fix usages in views * Fix indentation * Fix issue with delete language * Update nuget pacakges * Clear elements cache when content is deleted instead of trying to update it * Reset publishedModelFactory * Fixed publishing --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk> Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Co-authored-by: kjac <kja@umbraco.dk>
2024-10-01 15:03:02 +02:00
public NewDefaultUrlProvider(
IOptionsMonitor<RequestHandlerSettings> requestSettings,
Serverside generated preview URLs (#20021) * Serverside generated preview URLs * Add URL provider notation to UrlInfo * Change preview URL generation to happen at preview time based on provider alias * Update XML docs * Always add culture (if available) to preview URL * Do not log user input (security vulnerability) * Fix typo * Re-generate TypeScript client from Management API * Deprecated `UmbDocumentPreviewRepository.enter()` (for v19) Fixed TS errors Added temp stub for `getPreviewUrl` * Adds `previewOption` extension-type * Adds "default" `previewOption` kind * Relocated "Save and Preview" workspace action reworked using the "default" `previewOption` kind. * Added stub for "urlProvider" `previewOption` kind * Renamed "workspace-action-default-kind.element.ts" to a more suitable filename. Exported element so can be reused in other packages, e.g. documents, for the new "save and preview" feature. * Refactored "Save and Preview" button to work with first action's manifest/API. * Reverted `previewOption` extension-type Re-engineered to make a "urlProvider" kind for `workspaceActionMenuItem`. This is to simplify the extension point and surrounding logic. * Modified `saveAndPreview` Document Workspace Context to accept a URL Provider Alias. * Refactored "Save and Preview" button to extend `UmbWorkspaceActionElement`. This did mean exposing certain methods/properties to be overridable. * Used `umbPeekError` to surface any errors to the user * Renamed `urlProvider` kind to `previewOption` * Relocated `urlProviderAlias` inside the `meta` property * also throw an error * Added missing `await` * Fix build errors after forward merge --------- Co-authored-by: leekelleher <leekelleher@gmail.com> Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Co-authored-by: Laura Neto <12862535+lauraneto@users.noreply.github.com>
2025-10-08 08:27:01 +02:00
ILogger<NewDefaultUrlProvider> logger,
V15: Remove Nucache (#17166) * Remove nucache reference from Web.Common * Get tests building-ish * Move ReservedFieldNamesService to the right project * Remove IPublishedSnapshotStatus * Added functionality to the INavigationQueryService to get root keys * Fixed issue with navigation * Remove IPublishedSnapshot from UmbracoContext * Begin removing usage of IPublishedSnapshot from PublishedContentExtensions * Fix PublishedContentExtensions.cs * Don't use snapshots in delivery media api * Use IPublishedMediaCache in QueryMediaApiController * Remove more usages of IPublishedSnapshotAccessor * Comment out tests * Remove more usages of PublishedSnapshotAccessor * Remove PublishedSnapshot from property * Fixed test build * Fix errors * Fix some tests * Delete NuCache 🎉 * Implement DatabaseCacheRebuilder * Remove usage of IPublishedSnapshotService * Remove IPublishedSnapshotService * Remove TestPublishedSnapshotAccessor and make tests build * Don't test Snapshot cachelevel It's no longer supported * Fix BlockEditorConverter Element != Element document type * Remember to set cachemanager * Fix RichTextParserTests * Implement TryGetLevel on INavigationQueryService * Fake level and obsolete it in PublishedContent * Remove ChildrenForAllCultures * Hack Path property on PublishedContent * Remove usages of IPublishedSnapshot in tests * More ConvertersTests * Add hybrid cache to integration tests We can actually do this now because we no longer save files on disk * Rename IPublishedSnapshotRebuilder to ICacheRebuilder * Comment out tests * V15: Replacing the usages of Parent (navigation data) from IPublishedContent (#17125) * Fix .Parent references in PublishedContentExtensions * Add missing methods to FriendlyPublishedContentExtensions (ones that you were able to call on the content directly as they now require extra params) * Fix references from the extension methods * Fix dependencies in tests * Replace IPublishedSnapshotAccessor with the content cache in tests * Resolving more .Parent references * Fix unit tests * Obsolete and use extension methods * Remove private method and use extension instead * Moving code around * Fix tests * Fix more references * Cleanup * Fix more usages * Resolve merge conflict * Fix tests * Cleanup * Fix more tests * Fixed unit tests * Cleanup * Replace last usages --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk> * Remove usage of IPublishedSnapshotAccessor from IRequestItemProvider * Post merge fixup * Remo IPublishedSnapshot * Add HasAny to IDocumentUrlService * Fix TextBuilder * Fix modelsbuilder tests * Use explicit types * Implement GetByContentType * Support element types in PublishedContentTypeCache * Run enlistments before publishing notifications * Fix elements cache refreshing * Implement GetByUdi * Implement GetAtRoot * Implement GetByRoute * Reimplement GetRouteById * Fix blocks unit tests * Initialize domain cache on boot * Only return routes with domains on non default lanauges * V15: Replacing the usages of `Children` (navigation data) from `IPublishedContent` (#17159) * Update params in PublishedContentExtensions to the general interfaces for the published cache and navigation service, so that we can use the extension methods on both documents and media * Introduce GetParent() which uses the right services * Fix obsolete message on .Parent * Obsolete .Children * Fix usages of Children for ApiMediaQueryService * Fix usage in internal * Fix usages in views * Fix indentation * Fix issue with delete language * Update nuget pacakges * Clear elements cache when content is deleted instead of trying to update it * Reset publishedModelFactory * Fixed publishing --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk> Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Co-authored-by: kjac <kja@umbraco.dk>
2024-10-01 15:03:02 +02:00
ISiteDomainMapper siteDomainMapper,
IUmbracoContextAccessor umbracoContextAccessor,
UriUtility uriUtility,
IPublishedContentCache publishedContentCache,
IDomainCache domainCache,
IIdKeyMap idKeyMap,
IDocumentUrlService documentUrlService,
IDocumentNavigationQueryService navigationQueryService,
IPublishedContentStatusFilteringService publishedContentStatusFilteringService,
ILanguageService languageService)
V15: Remove Nucache (#17166) * Remove nucache reference from Web.Common * Get tests building-ish * Move ReservedFieldNamesService to the right project * Remove IPublishedSnapshotStatus * Added functionality to the INavigationQueryService to get root keys * Fixed issue with navigation * Remove IPublishedSnapshot from UmbracoContext * Begin removing usage of IPublishedSnapshot from PublishedContentExtensions * Fix PublishedContentExtensions.cs * Don't use snapshots in delivery media api * Use IPublishedMediaCache in QueryMediaApiController * Remove more usages of IPublishedSnapshotAccessor * Comment out tests * Remove more usages of PublishedSnapshotAccessor * Remove PublishedSnapshot from property * Fixed test build * Fix errors * Fix some tests * Delete NuCache 🎉 * Implement DatabaseCacheRebuilder * Remove usage of IPublishedSnapshotService * Remove IPublishedSnapshotService * Remove TestPublishedSnapshotAccessor and make tests build * Don't test Snapshot cachelevel It's no longer supported * Fix BlockEditorConverter Element != Element document type * Remember to set cachemanager * Fix RichTextParserTests * Implement TryGetLevel on INavigationQueryService * Fake level and obsolete it in PublishedContent * Remove ChildrenForAllCultures * Hack Path property on PublishedContent * Remove usages of IPublishedSnapshot in tests * More ConvertersTests * Add hybrid cache to integration tests We can actually do this now because we no longer save files on disk * Rename IPublishedSnapshotRebuilder to ICacheRebuilder * Comment out tests * V15: Replacing the usages of Parent (navigation data) from IPublishedContent (#17125) * Fix .Parent references in PublishedContentExtensions * Add missing methods to FriendlyPublishedContentExtensions (ones that you were able to call on the content directly as they now require extra params) * Fix references from the extension methods * Fix dependencies in tests * Replace IPublishedSnapshotAccessor with the content cache in tests * Resolving more .Parent references * Fix unit tests * Obsolete and use extension methods * Remove private method and use extension instead * Moving code around * Fix tests * Fix more references * Cleanup * Fix more usages * Resolve merge conflict * Fix tests * Cleanup * Fix more tests * Fixed unit tests * Cleanup * Replace last usages --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk> * Remove usage of IPublishedSnapshotAccessor from IRequestItemProvider * Post merge fixup * Remo IPublishedSnapshot * Add HasAny to IDocumentUrlService * Fix TextBuilder * Fix modelsbuilder tests * Use explicit types * Implement GetByContentType * Support element types in PublishedContentTypeCache * Run enlistments before publishing notifications * Fix elements cache refreshing * Implement GetByUdi * Implement GetAtRoot * Implement GetByRoute * Reimplement GetRouteById * Fix blocks unit tests * Initialize domain cache on boot * Only return routes with domains on non default lanauges * V15: Replacing the usages of `Children` (navigation data) from `IPublishedContent` (#17159) * Update params in PublishedContentExtensions to the general interfaces for the published cache and navigation service, so that we can use the extension methods on both documents and media * Introduce GetParent() which uses the right services * Fix obsolete message on .Parent * Obsolete .Children * Fix usages of Children for ApiMediaQueryService * Fix usage in internal * Fix usages in views * Fix indentation * Fix issue with delete language * Update nuget pacakges * Clear elements cache when content is deleted instead of trying to update it * Reset publishedModelFactory * Fixed publishing --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk> Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Co-authored-by: kjac <kja@umbraco.dk>
2024-10-01 15:03:02 +02:00
{
_requestSettings = requestSettings.CurrentValue;
_logger = logger;
_siteDomainMapper = siteDomainMapper;
_umbracoContextAccessor = umbracoContextAccessor;
_uriUtility = uriUtility;
_publishedContentCache = publishedContentCache;
_domainCache = domainCache;
_idKeyMap = idKeyMap;
_documentUrlService = documentUrlService;
_navigationQueryService = navigationQueryService;
_publishedContentStatusFilteringService = publishedContentStatusFilteringService;
_languageService = languageService;
V15: Remove Nucache (#17166) * Remove nucache reference from Web.Common * Get tests building-ish * Move ReservedFieldNamesService to the right project * Remove IPublishedSnapshotStatus * Added functionality to the INavigationQueryService to get root keys * Fixed issue with navigation * Remove IPublishedSnapshot from UmbracoContext * Begin removing usage of IPublishedSnapshot from PublishedContentExtensions * Fix PublishedContentExtensions.cs * Don't use snapshots in delivery media api * Use IPublishedMediaCache in QueryMediaApiController * Remove more usages of IPublishedSnapshotAccessor * Comment out tests * Remove more usages of PublishedSnapshotAccessor * Remove PublishedSnapshot from property * Fixed test build * Fix errors * Fix some tests * Delete NuCache 🎉 * Implement DatabaseCacheRebuilder * Remove usage of IPublishedSnapshotService * Remove IPublishedSnapshotService * Remove TestPublishedSnapshotAccessor and make tests build * Don't test Snapshot cachelevel It's no longer supported * Fix BlockEditorConverter Element != Element document type * Remember to set cachemanager * Fix RichTextParserTests * Implement TryGetLevel on INavigationQueryService * Fake level and obsolete it in PublishedContent * Remove ChildrenForAllCultures * Hack Path property on PublishedContent * Remove usages of IPublishedSnapshot in tests * More ConvertersTests * Add hybrid cache to integration tests We can actually do this now because we no longer save files on disk * Rename IPublishedSnapshotRebuilder to ICacheRebuilder * Comment out tests * V15: Replacing the usages of Parent (navigation data) from IPublishedContent (#17125) * Fix .Parent references in PublishedContentExtensions * Add missing methods to FriendlyPublishedContentExtensions (ones that you were able to call on the content directly as they now require extra params) * Fix references from the extension methods * Fix dependencies in tests * Replace IPublishedSnapshotAccessor with the content cache in tests * Resolving more .Parent references * Fix unit tests * Obsolete and use extension methods * Remove private method and use extension instead * Moving code around * Fix tests * Fix more references * Cleanup * Fix more usages * Resolve merge conflict * Fix tests * Cleanup * Fix more tests * Fixed unit tests * Cleanup * Replace last usages --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk> * Remove usage of IPublishedSnapshotAccessor from IRequestItemProvider * Post merge fixup * Remo IPublishedSnapshot * Add HasAny to IDocumentUrlService * Fix TextBuilder * Fix modelsbuilder tests * Use explicit types * Implement GetByContentType * Support element types in PublishedContentTypeCache * Run enlistments before publishing notifications * Fix elements cache refreshing * Implement GetByUdi * Implement GetAtRoot * Implement GetByRoute * Reimplement GetRouteById * Fix blocks unit tests * Initialize domain cache on boot * Only return routes with domains on non default lanauges * V15: Replacing the usages of `Children` (navigation data) from `IPublishedContent` (#17159) * Update params in PublishedContentExtensions to the general interfaces for the published cache and navigation service, so that we can use the extension methods on both documents and media * Introduce GetParent() which uses the right services * Fix obsolete message on .Parent * Obsolete .Children * Fix usages of Children for ApiMediaQueryService * Fix usage in internal * Fix usages in views * Fix indentation * Fix issue with delete language * Update nuget pacakges * Clear elements cache when content is deleted instead of trying to update it * Reset publishedModelFactory * Fixed publishing --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk> Co-authored-by: Elitsa Marinovska <21998037+elit0451@users.noreply.github.com> Co-authored-by: kjac <kja@umbraco.dk>
2024-10-01 15:03:02 +02:00
requestSettings.OnChange(x => _requestSettings = x);
}
Serverside generated preview URLs (#20021) * Serverside generated preview URLs * Add URL provider notation to UrlInfo * Change preview URL generation to happen at preview time based on provider alias * Update XML docs * Always add culture (if available) to preview URL * Do not log user input (security vulnerability) * Fix typo * Re-generate TypeScript client from Management API * Deprecated `UmbDocumentPreviewRepository.enter()` (for v19) Fixed TS errors Added temp stub for `getPreviewUrl` * Adds `previewOption` extension-type * Adds "default" `previewOption` kind * Relocated "Save and Preview" workspace action reworked using the "default" `previewOption` kind. * Added stub for "urlProvider" `previewOption` kind * Renamed "workspace-action-default-kind.element.ts" to a more suitable filename. Exported element so can be reused in other packages, e.g. documents, for the new "save and preview" feature. * Refactored "Save and Preview" button to work with first action's manifest/API. * Reverted `previewOption` extension-type Re-engineered to make a "urlProvider" kind for `workspaceActionMenuItem`. This is to simplify the extension point and surrounding logic. * Modified `saveAndPreview` Document Workspace Context to accept a URL Provider Alias. * Refactored "Save and Preview" button to extend `UmbWorkspaceActionElement`. This did mean exposing certain methods/properties to be overridable. * Used `umbPeekError` to surface any errors to the user * Renamed `urlProvider` kind to `previewOption` * Relocated `urlProviderAlias` inside the `meta` property * also throw an error * Added missing `await` * Fix build errors after forward merge --------- Co-authored-by: leekelleher <leekelleher@gmail.com> Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Co-authored-by: Laura Neto <12862535+lauraneto@users.noreply.github.com>
2025-10-08 08:27:01 +02:00
/// <inheritdoc />
public string Alias => Constants.UrlProviders.Content;
/// <summary>
/// Gets the other URLs of a published content.
/// </summary>
/// <param name="id">The published content id.</param>
/// <param name="current">The current absolute URL.</param>
/// <returns>The other URLs for the published content.</returns>
/// <remarks>
/// <para>
/// Other URLs are those that <c>GetUrl</c> would not return in the current context, but would be valid
/// URLs for the node in other contexts (different domain for current request, umbracoUrlAlias...).
/// </para>
/// </remarks>
public virtual IEnumerable<UrlInfo> GetOtherUrls(int id, Uri current)
{
Attempt<Guid> keyAttempt = _idKeyMap.GetKeyForId(id, UmbracoObjectTypes.Document);
if (keyAttempt.Success is false)
{
yield break;
}
Guid key = keyAttempt.Result;
IPublishedContent? node = _publishedContentCache.GetById(key);
if (node == null)
{
yield break;
}
// look for domains, walking up the tree
IPublishedContent? n = node;
IEnumerable<DomainAndUri>? domainUris =
DomainUtilities.DomainsForNode(_domainCache, _siteDomainMapper, n.Id, current, false);
// n is null at root
while (domainUris == null && n != null)
{
n = n.Parent<IPublishedContent>(_navigationQueryService, _publishedContentStatusFilteringService); // move to parent node
domainUris = n == null
? null
: DomainUtilities.DomainsForNode(_domainCache, _siteDomainMapper, n.Id, current);
}
// no domains = exit
if (domainUris == null)
{
yield break;
}
foreach (DomainAndUri d in domainUris)
{
var culture = d.Culture;
// although we are passing in culture here, if any node in this path is invariant, it ignores the culture anyways so this is ok
var route = GetLegacyRouteFormatById(key, culture);
if (route == null || route == "#")
{
continue;
}
// need to strip off the leading ID for the route if it exists (occurs if the route is for a node with a domain assigned)
var pos = route.IndexOf('/', StringComparison.Ordinal);
var path = pos == 0 ? route : route[pos..];
var uri = new Uri(CombinePaths(d.Uri.GetLeftPart(UriPartial.Path), path));
uri = _uriUtility.UriFromUmbraco(uri, _requestSettings);
Serverside generated preview URLs (#20021) * Serverside generated preview URLs * Add URL provider notation to UrlInfo * Change preview URL generation to happen at preview time based on provider alias * Update XML docs * Always add culture (if available) to preview URL * Do not log user input (security vulnerability) * Fix typo * Re-generate TypeScript client from Management API * Deprecated `UmbDocumentPreviewRepository.enter()` (for v19) Fixed TS errors Added temp stub for `getPreviewUrl` * Adds `previewOption` extension-type * Adds "default" `previewOption` kind * Relocated "Save and Preview" workspace action reworked using the "default" `previewOption` kind. * Added stub for "urlProvider" `previewOption` kind * Renamed "workspace-action-default-kind.element.ts" to a more suitable filename. Exported element so can be reused in other packages, e.g. documents, for the new "save and preview" feature. * Refactored "Save and Preview" button to work with first action's manifest/API. * Reverted `previewOption` extension-type Re-engineered to make a "urlProvider" kind for `workspaceActionMenuItem`. This is to simplify the extension point and surrounding logic. * Modified `saveAndPreview` Document Workspace Context to accept a URL Provider Alias. * Refactored "Save and Preview" button to extend `UmbWorkspaceActionElement`. This did mean exposing certain methods/properties to be overridable. * Used `umbPeekError` to surface any errors to the user * Renamed `urlProvider` kind to `previewOption` * Relocated `urlProviderAlias` inside the `meta` property * also throw an error * Added missing `await` * Fix build errors after forward merge --------- Co-authored-by: leekelleher <leekelleher@gmail.com> Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Co-authored-by: Laura Neto <12862535+lauraneto@users.noreply.github.com>
2025-10-08 08:27:01 +02:00
yield return UrlInfo.FromUri(uri, Alias, culture);
}
}
Serverside generated preview URLs (#20021) * Serverside generated preview URLs * Add URL provider notation to UrlInfo * Change preview URL generation to happen at preview time based on provider alias * Update XML docs * Always add culture (if available) to preview URL * Do not log user input (security vulnerability) * Fix typo * Re-generate TypeScript client from Management API * Deprecated `UmbDocumentPreviewRepository.enter()` (for v19) Fixed TS errors Added temp stub for `getPreviewUrl` * Adds `previewOption` extension-type * Adds "default" `previewOption` kind * Relocated "Save and Preview" workspace action reworked using the "default" `previewOption` kind. * Added stub for "urlProvider" `previewOption` kind * Renamed "workspace-action-default-kind.element.ts" to a more suitable filename. Exported element so can be reused in other packages, e.g. documents, for the new "save and preview" feature. * Refactored "Save and Preview" button to work with first action's manifest/API. * Reverted `previewOption` extension-type Re-engineered to make a "urlProvider" kind for `workspaceActionMenuItem`. This is to simplify the extension point and surrounding logic. * Modified `saveAndPreview` Document Workspace Context to accept a URL Provider Alias. * Refactored "Save and Preview" button to extend `UmbWorkspaceActionElement`. This did mean exposing certain methods/properties to be overridable. * Used `umbPeekError` to surface any errors to the user * Renamed `urlProvider` kind to `previewOption` * Relocated `urlProviderAlias` inside the `meta` property * also throw an error * Added missing `await` * Fix build errors after forward merge --------- Co-authored-by: leekelleher <leekelleher@gmail.com> Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Co-authored-by: Laura Neto <12862535+lauraneto@users.noreply.github.com>
2025-10-08 08:27:01 +02:00
#region GetPreviewUrl
/// <inheritdoc />
public Task<UrlInfo?> GetPreviewUrlAsync(IContent content, string? culture, string? segment)
=> Task.FromResult<UrlInfo?>(
UrlInfo.AsUrl(
$"preview?id={content.Key}&culture={culture}&segment={segment}",
Serverside generated preview URLs (#20021) * Serverside generated preview URLs * Add URL provider notation to UrlInfo * Change preview URL generation to happen at preview time based on provider alias * Update XML docs * Always add culture (if available) to preview URL * Do not log user input (security vulnerability) * Fix typo * Re-generate TypeScript client from Management API * Deprecated `UmbDocumentPreviewRepository.enter()` (for v19) Fixed TS errors Added temp stub for `getPreviewUrl` * Adds `previewOption` extension-type * Adds "default" `previewOption` kind * Relocated "Save and Preview" workspace action reworked using the "default" `previewOption` kind. * Added stub for "urlProvider" `previewOption` kind * Renamed "workspace-action-default-kind.element.ts" to a more suitable filename. Exported element so can be reused in other packages, e.g. documents, for the new "save and preview" feature. * Refactored "Save and Preview" button to work with first action's manifest/API. * Reverted `previewOption` extension-type Re-engineered to make a "urlProvider" kind for `workspaceActionMenuItem`. This is to simplify the extension point and surrounding logic. * Modified `saveAndPreview` Document Workspace Context to accept a URL Provider Alias. * Refactored "Save and Preview" button to extend `UmbWorkspaceActionElement`. This did mean exposing certain methods/properties to be overridable. * Used `umbPeekError` to surface any errors to the user * Renamed `urlProvider` kind to `previewOption` * Relocated `urlProviderAlias` inside the `meta` property * also throw an error * Added missing `await` * Fix build errors after forward merge --------- Co-authored-by: leekelleher <leekelleher@gmail.com> Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Co-authored-by: Laura Neto <12862535+lauraneto@users.noreply.github.com>
2025-10-08 08:27:01 +02:00
Alias,
culture,
isExternal: false));
#endregion
/// <summary>
/// Gets the legacy route format by id
/// </summary>
/// <param name="key"></param>
/// <param name="culture"></param>
/// <returns></returns>
/// <remarks>
/// When no domain is set the route can be something like /child/grandchild
/// When a domain is set, the route can be something like 1234/grandchild
/// </remarks>
private string GetLegacyRouteFormatById(Guid key, string? culture)
{
var isDraft = _umbracoContextAccessor.GetRequiredUmbracoContext().InPreviewMode;
return _documentUrlService.GetLegacyRouteFormat(key, culture, isDraft);
}
/// <inheritdoc />
public virtual UrlInfo? GetUrl(IPublishedContent content, UrlMode mode, string? culture, Uri current)
{
if (!current.IsAbsoluteUri)
{
throw new ArgumentException("Current URL must be absolute.", nameof(current));
}
// This might seem to be some code duplication, as we do the same check in GetLegacyRouteFormat
// but this is strictly neccesary, as if we're coming from a published notification
// this document will still not always be in the memory cache. And thus we have to hit the DB
// We have the published content now, so we can check if the culture is published, and thus avoid the DB hit.
string route;
var isDraft = _umbracoContextAccessor.GetRequiredUmbracoContext().InPreviewMode;
if (isDraft is false && string.IsNullOrWhiteSpace(culture) is false && content.Cultures.Any() && content.IsInvariantOrHasCulture(culture) is false)
{
route = "#";
}
else
{
route = GetLegacyRouteFormatById(content.Key, culture);
}
// will not use cache if previewing
return GetUrlFromRoute(route, content.Id, current, mode, culture);
}
/// <summary>
/// Gets the URL from the provided route.
/// </summary>
internal UrlInfo? GetUrlFromRoute(
string? route,
int id,
Uri current,
UrlMode mode,
string? culture)
{
if (string.IsNullOrWhiteSpace(route) || route.Equals("#"))
{
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.LogDebug(
"Couldn't find any page with nodeId={NodeId}. This is most likely caused by the page not being published.",
id);
}
return null;
}
// extract domainUri and path
// route is /<path> or <domainRootId>/<path>
var pos = route.IndexOf('/', StringComparison.Ordinal);
var path = pos == 0 ? route : route[pos..];
DomainAndUri? domainUri = pos == 0
? null
: DomainUtilities.DomainForNode(
_domainCache,
_siteDomainMapper,
int.Parse(route[..pos], CultureInfo.InvariantCulture),
current,
culture);
var defaultCulture = _languageService.GetDefaultIsoCodeAsync().GetAwaiter().GetResult();
Merge branch 'v15/dev' into v16/dev (#18971) * Only prevent the unpublish or delete of a related item when configured to do so if it is related as a child, not as a parent (#18886) * Only prevent the unpubkish or delete of a related item when configured to do so if it is related as a child, not as a parent. * Fixed incorect parameter names. * Fixed failing integration tests. * Use using variable instead to reduce nesting * Applied suggestions from code review. * Used simple using statement throughout RelationService for consistency. * Applied XML header comments consistently. --------- Co-authored-by: mole <nikolajlauridsen@protonmail.ch> * Feature: highlight invariant doc with variant blocks is unsupported (#18806) * mark variant blocks in invariant docs as invalid * implement RTE Blocks * Fix pagination for users restricted by start nodes (#18907) * Fix pagination for users restricted by start nodes * Default implementation to avoid breakage * Review comments * Fix failing test * Add media start node tests * Fix issue preventing blueprint derived values from being scaffolded (#18917) * Fix issue preventing blueprint derived values from being scaffolded. * fix manipulating frooen array * compare with variantId as well --------- Co-authored-by: Niels Lyngsø <niels.lyngso@gmail.com> * ci: add Azure Static Web Apps workflow file on-behalf-of: @Azure opensource@microsoft.com * ci: add Azure Static Web Apps workflow file on-behalf-of: @Azure opensource@microsoft.com * ci: add Azure Static Web Apps workflow file on-behalf-of: @Azure opensource@microsoft.com * Remove admin permission on user configuration, allowing users with user section access only to manaage users and groups. (#18848) * Tiptap RTE: Style Menu extension kind (#18918) * Adds 'styleMenu' Tiptap toolbar extension kind * Adds icons for `<h4>` and `<p>` tags * Adds commands to HTML Global Attributes extension for setting the `class` and `id` attributes. * Renamed "default-tiptap-toolbar-element.api.ts" file The "element" part was confusing. * Toolbar Menu: uses correct `item` value * Cascading Menu: adds localization for the label * Adds `label` attribute to UUI components for accessibility. * Toolbar Menu: uses correct `appearance` value * Removed unrequired `api` from Style Select * Destructs the `item.data` object * Ensure has children reflects only items with folder children when folders only are queried. (#18790) * Ensure has children reflects only items with folder children when folders only are queried. * Added supression for change to integration test public code. --------- Co-authored-by: Migaroez <geusens@gmail.com> * Only apply validation on content update to variant cultures where the editor has permission for the culture (#18778) * Only apply validation on content update to variant cultures where the editor has permission for the culture. * Remove inadvertent comment updates. * Fixed failing integration test. * Adds ancestor ID details on document tree and collection responses (#18909) * Populate ancestor keys on document tree response items. * Populate ancestor keys on document collection response items. * Update OpenApi.json * Use array of objects rather than Ids for the ancestor collection. * Update OpenApi.json. * Move publish with descendants to a background task with polling (#18497) * Use background queue for database cache rebuild and track rebuilding status. * Updated OpenApi.json and client-side types. * Updated client to poll for completion of database rebuild. * Move IBackgroundTaskQueue to core and prepare publish branch to run as background task. * Endpoints for retrieval of status and result from branch publish operations. * Poll and retrieve result for publish with descendants. * Handled issues from testing. * Rework to single controller for status and result. * Updated client side sdk. * OpenApi post dev merge gen --------- Co-authored-by: Migaroez <geusens@gmail.com> * Clear roots before rebuilding navigation dictionary (#18766) * Clear roots before rebuilding navigation dictionary. * Added tests to verify fix. * Correct test implementation. * Convert integration tests with method overloads into test cases. * Integration test compatibility supressions. * Fixes save of empty, invariant block list on variant content. (#18932) * remove unnecessary code (#18927) * V15/bugfix/fix route issue from 18859 (#18931) * unique check * unique for workspace empty path * more unique routes * Bump vite from 6.2.3 to 6.2.4 in /src/Umbraco.Web.UI.Client Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.2.3 to 6.2.4. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v6.2.4/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v6.2.4/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-version: 6.2.4 dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> * removes autogenerated workflows * make getHasUnpersistedChanges public (#18929) * Added management API endpoint, service and repository for retrieval of references from the recycle bin (#18882) * Added management API endpoint, service and repository for retrieval of references from the recycle bin. * Update src/Umbraco.Cms.Api.Management/Controllers/Document/RecycleBin/ReferencedByDocumentRecycleBinController.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Removed unused code. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Updated management API endpoint and model for data type references to align with that used for documents, media etc. (#18905) * Updated management API endpoint and model for data type references to align with that used for documents, media etc. * Refactoring. * Update src/Umbraco.Core/Constants-ReferenceTypes.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fixed typos. * Added id to tracked reference content type response. * Updated OpenApi.json. * Added missing updates. * Renamed model and constants from code review feedback. * Fix typo * Fix multiple enumeration --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: mole <nikolajlauridsen@protonmail.ch> * Skip lock tests * Look-up redirect in content finder for multi-lingual sites using path and legacy route prefixed with the integer ID of the node with domains defined (#18763) * Look-up redirect in content finder for multi-lingual sites using path and legacy route prefixed with the integer ID of the node with domains defined. * Added tests to verify functionality. * Added reference to previous PR. * Referenced second PR. * Assemble URLs for all cultures, not just the default. * Revert previous update. * Display an original URL if we have one. * Bump vite from 6.2.4 to 6.2.5 in /src/Umbraco.Web.UI.Client Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.2.4 to 6.2.5. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v6.2.5/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v6.2.5/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-version: 6.2.5 dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> * Add raw value validation to multiple text strings property editor (#18936) * Add raw value validation to multiple text strings property editor * Added additional assert on unit test and comment on validation logic. * Don't remove items to obtain a valid value --------- Co-authored-by: Andy Butland <abutland73@gmail.com> * Integration tests for content publishing with ancestor unpublished (#18941) * Resolved warnings in test class. * Refactor regions into partial classes. * Aligned test names. * Variable name refactoring. * Added tests for unpublished paths. * Adjust tests to verify current behaviour. * Cleaned up project file. * fix circular icon import (#18952) * remove segment toggle for elements (#18949) * Fix modal route registration circular import (#18953) * fix modal route registration circular import * Update modal-route-registration.controller.ts * V15/fix/18595 (#18925) * fix for #18595 * updates the en.ts * Avoid unneeded Dictionary operations (#18890) * Avoid some heap allocations * Remove unneeded double seek * Avoid allocating new empty arrays, reuse existing empty array * Avoid allocating strings for parsing comma separated int values (#18199) * Data type References UI: Workspace + Delete (#18914) * Updated management API endpoint and model for data type references to align with that used for documents, media etc. * Refactoring. * Update src/Umbraco.Core/Constants-ReferenceTypes.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fixed typos. * generate server models * add extension slot * register data type reference info app * add reference data mappers * Added id to tracked reference content type response. * Updated OpenApi.json. * Added missing updates. * generate new models * update models * register ref item * remove debugger * render types * register member type property type ref * register media type property type ref * Renamed model and constants from code review feedback. * register reference workspace info app kind * use kind for document references * use kind for media references * use kind for member references * use deleteWithRelation kind when deleting data types * fix manifest types * fix types * Update types.gen.ts * update code to fit new server models --------- Co-authored-by: Andy Butland <abutland73@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Feature: discard changes for block workspace (#18930) * make getHasUnpersistedChanges public * Discard changes impl for Block Workspace * fix 18367 (#18956) * Merge commit from fork * Prevent path traveral vulnerability with upload of temporary files. * Used BadRequest instead of NotFound for invalid file name response. * V15 QA Fixing the failing media acceptance tests (#18881) * Fixed the function name due to test helper changes * Updated assertion steps due to UI changes * Added more waits * Bumped version * Increase timeout * Reverted --------- Co-authored-by: Andreas Zerbst <73799582+andr317c@users.noreply.github.com> * V15 QA added clipboard test for not being able to copy to root when block is not allowed at root (#18937) * Added clipboard test * Bumped version * Updated to use the name * Run all tests on the pipeline * Reverted command * build: adjusts circular ref number to 4 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Andy Butland <abutland73@gmail.com> Co-authored-by: mole <nikolajlauridsen@protonmail.ch> Co-authored-by: Niels Lyngsø <nsl@umbraco.dk> Co-authored-by: Niels Lyngsø <niels.lyngso@gmail.com> Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Co-authored-by: Lee Kelleher <leekelleher@users.noreply.github.com> Co-authored-by: Migaroez <geusens@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Co-authored-by: Mads Rasmussen <madsr@hey.com> Co-authored-by: Jacob Welander Jensen <64834767+Welander1994@users.noreply.github.com> Co-authored-by: Henrik <hg@impact.dk> Co-authored-by: Sebastiaan Janssen <sebastiaan@umbraco.com> Co-authored-by: Nhu Dinh <150406148+nhudinh0309@users.noreply.github.com> Co-authored-by: Andreas Zerbst <73799582+andr317c@users.noreply.github.com>
2025-04-09 09:58:01 +02:00
if (domainUri is not null ||
string.IsNullOrEmpty(culture) ||
culture.Equals(defaultCulture, StringComparison.InvariantCultureIgnoreCase))
{
Serverside generated preview URLs (#20021) * Serverside generated preview URLs * Add URL provider notation to UrlInfo * Change preview URL generation to happen at preview time based on provider alias * Update XML docs * Always add culture (if available) to preview URL * Do not log user input (security vulnerability) * Fix typo * Re-generate TypeScript client from Management API * Deprecated `UmbDocumentPreviewRepository.enter()` (for v19) Fixed TS errors Added temp stub for `getPreviewUrl` * Adds `previewOption` extension-type * Adds "default" `previewOption` kind * Relocated "Save and Preview" workspace action reworked using the "default" `previewOption` kind. * Added stub for "urlProvider" `previewOption` kind * Renamed "workspace-action-default-kind.element.ts" to a more suitable filename. Exported element so can be reused in other packages, e.g. documents, for the new "save and preview" feature. * Refactored "Save and Preview" button to work with first action's manifest/API. * Reverted `previewOption` extension-type Re-engineered to make a "urlProvider" kind for `workspaceActionMenuItem`. This is to simplify the extension point and surrounding logic. * Modified `saveAndPreview` Document Workspace Context to accept a URL Provider Alias. * Refactored "Save and Preview" button to extend `UmbWorkspaceActionElement`. This did mean exposing certain methods/properties to be overridable. * Used `umbPeekError` to surface any errors to the user * Renamed `urlProvider` kind to `previewOption` * Relocated `urlProviderAlias` inside the `meta` property * also throw an error * Added missing `await` * Fix build errors after forward merge --------- Co-authored-by: leekelleher <leekelleher@gmail.com> Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Co-authored-by: Laura Neto <12862535+lauraneto@users.noreply.github.com>
2025-10-08 08:27:01 +02:00
Uri url = AssembleUrl(domainUri, path, current, mode);
return UrlInfo.FromUri(url, Alias, culture);
}
return null;
}
private Uri AssembleUrl(DomainAndUri? domainUri, string path, Uri current, UrlMode mode)
{
Uri uri;
// ignore vdir at that point, UriFromUmbraco will do it
// no domain was found
if (domainUri == null)
{
if (current == null)
{
mode = UrlMode.Relative; // best we can do
}
switch (mode)
{
case UrlMode.Absolute:
uri = new Uri(current!.GetLeftPart(UriPartial.Authority) + path);
break;
case UrlMode.Relative:
case UrlMode.Auto:
uri = new Uri(path, UriKind.Relative);
break;
default:
throw new ArgumentOutOfRangeException(nameof(mode));
}
}
// a domain was found
else
{
if (mode == UrlMode.Auto)
{
// this check is a little tricky, we can't just compare domains
if (current != null && domainUri.Uri.GetLeftPart(UriPartial.Authority) ==
current.GetLeftPart(UriPartial.Authority))
{
mode = UrlMode.Relative;
}
else
{
mode = UrlMode.Absolute;
}
}
switch (mode)
{
case UrlMode.Absolute:
uri = new Uri(CombinePaths(domainUri.Uri.GetLeftPart(UriPartial.Path), path));
break;
case UrlMode.Relative:
uri = new Uri(CombinePaths(domainUri.Uri.AbsolutePath, path), UriKind.Relative);
break;
default:
throw new ArgumentOutOfRangeException(nameof(mode));
}
}
// UriFromUmbraco will handle vdir
// meaning it will add vdir into domain URLs too!
return _uriUtility.UriFromUmbraco(uri, _requestSettings);
}
private string CombinePaths(string path1, string path2)
{
var path = path1.TrimEnd(Constants.CharArrays.ForwardSlash) + path2;
return path == "/" ? path : path.TrimEnd(Constants.CharArrays.ForwardSlash);
}
}