You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Clicking internal link to uploaded file redirects to home instead of opening it #5012
Clicking on a direct in-post link to an uploaded file (e.g. an image link, <a href="https://example.com/assets/files/...jpg" class="UrlLink UrlLink--internal">) redirects the user to the forum's home page (/) instead of navigating to the file.
Opening the same link in a new tab (e.g. via "Open in new tab") works correctly and loads the image as expected — the issue only occurs on a direct in-app left-click.
Steps to Reproduce
Upload an image to a post (via FoF Upload or core upload)
The resulting link in the rendered post has class UrlLink UrlLink--internal
Left-click directly on the image/link within the post
Observe: instead of opening/viewing the image, the app redirects to the forum home page
Right-click → "Open in new tab" on the same link works fine and loads the image directly
Expected Behavior
Clicking the link should either:
Load/display the linked file (image), or
At minimum, not redirect to an unrelated page (home)
Root Cause (found via investigation)
Formatter::isInternalUrl() in vendor/flarum/core/src/Formatter/Formatter.php marks any same-host URL as internal (UrlLink--internal), including links to static uploaded files that have no corresponding Mithril route (e.g. /assets/files/...).
The client-side handler in js/src/forum/utils/routeInternalLinks.ts trusts this class without checking whether the path actually corresponds to a registered app route.
Since /assets/files/... doesn't match any registered Mithril route, m.route.set() silently falls back to the default route (home), per the same mechanism described in the code's own comment about forums installed in a subdirectory.
Context
Steps to Reproduce
Upload an image to a post (e.g. via FoF Upload or core upload)
The resulting link in the rendered post has class UrlLink UrlLink--internal
Left-click directly on the image/link within the post
Observe that instead of opening/viewing the image, the app redirects to the forum home page
Right-click → "Open in new tab" on the same link works fine and loads the image directly
Expected Behavior
Clicking the link should either load/display the linked file (image), or at minimum not redirect to an unrelated page (home).
Activity