fix: let a link to an uploaded file open instead of routing to the index - #5071
Open
jamalkamaladdin wants to merge 1 commit into
Open
jamalkamaladdin wants to merge 1 commit into
jamalkamaladdin wants to merge 1 commit into
Conversation
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.
Fixes #5012.
Changes proposed in this pull request:
Formatter marks every same-host URL as an internal link, including one under the assets path. routeInternalLinks hands that path to Mithril, and Mithril has no route for a file path and returns to the index.
A click on such a link now checks whether its href starts with assetsBaseUrl, and a same prefix leaves the click to the browser. Changed file: framework/core/js/src/forum/utils/routeInternalLinks.ts.
New test: "leaves an uploaded file under the assets path to the browser", in framework/core/js/tests/unit/forum/utils/routeInternalLinks.test.ts.
Reviewers should focus on:
assetsBaseUrl can point at a host other than the forum's own, and the existing origin check returns before the new check runs in that case.
Screenshot
This is routing behavior with no visual change.
Necessity
Confirmed
yarn testinjs/).composer test).