fix: tup-694 abs URLs to same domain should be rel#811
Merged
wesleyboar merged 5 commits intomainfrom Mar 6, 2024
Merged
Conversation
wesleyboar
commented
Mar 5, 2024
Comment on lines
-11
to
+13
| const links = document.getElementsByTagName('a'); | ||
| const links = document.querySelectorAll('body > :is(header, main, footer) a'); |
Member
Author
There was a problem hiding this comment.
Why? So that CMS Admin UI toolbar links are not affected. I noticed the placeholder snippet version of this PR was breaking the CMS Admin UI toolbar.
|
|
||
| const isMailto = ( link.href.indexOf('mailto:') === 0 ); | ||
| const isAbsolute = (link.href.indexOf('http') === 0); | ||
| const isSameHost = link.host === baseDocHost || link.host === baseDocHostWithSubdomain |
Member
Author
There was a problem hiding this comment.
New name? Yes. Renamed in noop polish PR #810.
R-Tomas-Gonzalez
approved these changes
Mar 5, 2024
Contributor
R-Tomas-Gonzalez
left a comment
There was a problem hiding this comment.
This looks good and worked for me.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Make
setTargetForExternalLinksalso change link URL to relative if it is absolute yet on same host.Related
Changes
setTargetForExternalLinksTesting
Set up:
Check out branch
fix/tup-694-absolute-urls-to-same-domain-should-be-relative.Update local CMS with new code (e.g. rebuild or "collectstatic").
Commands
make stop && make build && make startdocker-compose -f ./docker-compose.dev.yml up --detach && docker exec -it core_cms sh -c "python manage.py collectstatic --no-input"Open CMS e.g. http://localhost:8000/.
Test fix:
hrefwith absolute path.hrefwith a relative path.UI