Skip to content

Issue 34529 url field extract page name#34530

Open
erickgonzalez wants to merge 2 commits intomainfrom
issue-34529-url-field-extract-page-name
Open

Issue 34529 url field extract page name#34530
erickgonzalez wants to merge 2 commits intomainfrom
issue-34529-url-field-extract-page-name

Conversation

@erickgonzalez
Copy link
Member

@erickgonzalez erickgonzalez commented Feb 6, 2026

Fix: Extract page name from URL field for HTML pages

Problem

When creating HTML pages with URL fields containing path separators (e.g., /index, /act/index, /a/v/page), the entire path was being stored in the URL field instead of just the page name. This caused issues with page identification and routing.

Solution

Modified the URL field processing in ESContentletAPIImpl.java to extract only the final segment (page name) from URLs before setting the HTMLPageAssetAPI.URL_FIELD.

Changes Made

  • Implementation (ESContentletAPIImpl.java:8287-8290):

    • Added URL extraction logic that checks for path separators (/)
    • Extracts the substring after the last / when present
    • Preserves simple URLs without path separators unchanged
  • Test Coverage (ESContentletAPIImplTest.java):

    • Added comprehensive test method test_HTMLPage_URL_ShouldExtractLastPartAfterSlash()
    • 4 test scenarios covering different URL patterns:
      1. Simple URL: "index"  "index" (unchanged)
      2. Leading slash: "/index2"  "index2"
      3. Multiple segments: "/act/index3"  "index3"
      4. Deep path: "/a/v/page4"  "page4"

Behavior Examples

Input URL | Output URL | Description -- | -- | -- "index" | "index" | Simple URLs remain unchanged "/index" | "index" | Leading slash removed "/act/index" | "index" | Multi-segment path extracts final part "/a/v/page" | "page" | Deep paths extract page name only

Checklist

  •  Tests - Comprehensive test coverage added
  •  Translations - No translation changes required
  •  Security Implications Contemplated - No security impact, improves URL handling consistency

Fixes #34529


@erickgonzalez erickgonzalez marked this pull request as ready for review February 6, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants