Skip to content

Management API: Fix document URLs returning all languages for invariant content (closes #21459)#21473

Merged
AndyButland merged 1 commit intomainfrom
v17/bugfix/21459-show-only-variant-urls
Jan 22, 2026
Merged

Management API: Fix document URLs returning all languages for invariant content (closes #21459)#21473
AndyButland merged 1 commit intomainfrom
v17/bugfix/21459-show-only-variant-urls

Conversation

@AndyButland
Copy link
Contributor

@AndyButland AndyButland commented Jan 21, 2026

Description

This PR addresses the issue raised in #21459 where URLs for invariant content show for all languages in the "Info" workspace view.

Change Summary

  • Fixes the /umbraco/management/api/v1/document/urls endpoint returning URL records for all configured languages even for invariant documents.
  • For invariant content (content that doesn't vary by culture), only the default language URL is now returned.

Root Cause

It looks like this issue was introduced in PR #18072 "V15: Fix Url Preview" on January 29, 2025.

The PublishedUrlInfoProvider.GetAllAsync method was changed to iterate through all configured languages without checking if the content is variant or invariant. The previous implementation (IDocumentUrlService.ListUrlsAsync) had filtering logic that would skip non-default languages for content without assigned domains:

This filtering was lost when switching to the new IPublishedUrlInfoProvider.GetAllAsync implementation.

Fix

I haven't looked to revert any logic from that PR as it was doing more than handle the functionality related to this issue. Rather I think we can just check if the document is invariant, and if so, only consider the default language.

So fhe fix checks if the content type varies by culture before determining which languages to iterate:

  • Variant content: iterate through all languages (existing behaviour)
  • Invariant content: only use the default language's ISO code

Testing

I've added integration test Invariant_content_returns_only_default_language_url that verifies invariant content only returns one URL for the default language.

And in testing I see for invariant now only the default language and a single URL, and for variant the appropriate URL for the selected language.

Copilot AI review requested due to automatic review settings January 21, 2026 16:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a regression in the Management API's /umbraco/management/api/v1/document/urls endpoint where invariant content incorrectly returned URL records for all configured languages instead of just the default language. The fix adds a culture variation check before determining which languages to process.

Changes:

  • Modified PublishedUrlInfoProvider.GetAllAsync to check if content varies by culture before determining which languages to iterate
  • Added integration test to verify invariant content only returns the default language URL

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Umbraco.Core/Routing/PublishedUrlInfoProvider.cs Added conditional logic to iterate only through the default language for invariant content, preserving all-language iteration for variant content
tests/Umbraco.Tests.Integration/Umbraco.Core/Services/PublishedUrlInfoProviderTests.cs Added test case to verify invariant content returns only one URL for the default language when multiple languages are configured

@AndyButland AndyButland changed the title Management API: Fix document URLs returning all languages for invariant content Management API: Fix document URLs returning all languages for invariant content (closes #21459) Jan 21, 2026
Copy link
Member

@Zeegaan Zeegaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants