-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(uve): Added trailing slash when the url ends with /index (#31093)
PR Changes: https://github.com/user-attachments/assets/2329986e-5b34-4fc1-bc6d-4c7224199399 Algo this PR solves a VanityURL issue inside UVE: Issue before PR: https://github.com/user-attachments/assets/3bd2978d-9e30-4da0-af3c-7998c2b4a3ab Fix: https://github.com/user-attachments/assets/419b407a-9359-4af0-b380-1d76dfb5430d This pull request includes several changes to the `core-web/libs/portlets/edit-ema/portlet` module, focusing on URL sanitization and handling vanity URLs. The most important changes include modifications to the `DotPageApiService`, updates to the `sanitizeURL` utility function, and enhancements to the `withEditor` store feature. ### URL Sanitization and Handling: * [`core-web/libs/portlets/edit-ema/portlet/src/lib/services/dot-page-api.service.ts`](diffhunk://#diff-9acb0e7dc2619395c49047164381778d2b6d6c41f58b30aa3cd6a798044007c6L107-R108): Updated the URL sanitization logic to only remove leading slashes, instead of both leading and trailing slashes. * [`core-web/libs/portlets/edit-ema/portlet/src/lib/utils/index.ts`](diffhunk://#diff-2fd4d225bb33327848da73766ec5efbe037e3aed1a1e51a50c19f6a2be8cdb80L201-R202): Modified the `sanitizeURL` function to replace 'index' or '/index' at the end of the URL with a single slash, and to remove both starting and trailing slashes. ### Test Adjustments: * [`core-web/libs/portlets/edit-ema/portlet/src/lib/services/dot-page-api.service.spec.ts`](diffhunk://#diff-1dad8c8d685da624eaecb75a9607377dfa7168120d182df479ffceaed1a87858L86-R89): Updated tests to reflect the new URL sanitization logic by removing trailing slashes only. [[1]](diffhunk://#diff-1dad8c8d685da624eaecb75a9607377dfa7168120d182df479ffceaed1a87858L86-R89) [[2]](diffhunk://#diff-1dad8c8d685da624eaecb75a9607377dfa7168120d182df479ffceaed1a87858L133-R133) * [`core-web/libs/portlets/edit-ema/portlet/src/lib/utils/utils.spec.ts`](diffhunk://#diff-6b95047786d13d69ebdcb642c6d382bc35784a2ada53f95d1908119ab08dfb91L323-R327): Adjusted tests for the `sanitizeURL` function to validate the new behavior of handling 'index' and slashes. [[1]](diffhunk://#diff-6b95047786d13d69ebdcb642c6d382bc35784a2ada53f95d1908119ab08dfb91L323-R327) [[2]](diffhunk://#diff-6b95047786d13d69ebdcb642c6d382bc35784a2ada53f95d1908119ab08dfb91R339-R342) ### Vanity URL Handling: * [`core-web/libs/portlets/edit-ema/portlet/src/lib/store/features/editor/withEditor.ts`](diffhunk://#diff-86e692578757ed7f4f6cba5d0aeb07641312f3b17885825d1a45987153ae87f0R203-R205): Enhanced the `withEditor` store feature to properly handle vanity URLs by prioritizing the vanity URL over the page URI. * [`core-web/libs/portlets/edit-ema/portlet/src/lib/store/features/editor/withEditor.spec.ts`](diffhunk://#diff-48915538475425e5656151bb2a73df7a99b4c80c2817c085f96352ef3252d5cbR697-R712): Added a new test to ensure the correct URL is used when the page has a vanity URL. These changes ensure more consistent URL handling across the application and improve the robustness of the URL-related logic. --------- Co-authored-by: Kevin Davila <[email protected]>
- Loading branch information
1 parent
83e3277
commit dfbe70e
Showing
7 changed files
with
62 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters