Relative links broken in preview mode #4783

Closed
opened 2025-11-02 06:02:44 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @jdesgats on GitHub (Feb 3, 2020).

Description

When editing Markdown, links to other files in the repo are relative to the location of the file. However, when previewing changes, the rendered preview seem to render links from the repository root.

In the linked example, the link works as expected and links to https://try.gitea.io/testuser78944/test-markdown/src/branch/master/a/b/other.md. But try to edit the file and enable the preview mode: the link will be to https://try.gitea.io/testuser78944/test-markdown/src/branch/master/b/other.md instead (the a/ part for the relative link is stripped).

Screenshots

image

Originally created by @jdesgats on GitHub (Feb 3, 2020). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.11.0+rc2-8-g4b11f967b - Git version: 2.25.0 - Operating system: Debian Sid/Unstable - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (https://try.gitea.io/testuser78944/test-markdown/src/branch/master/a/doc.md) - [ ] No - [ ] Not relevant - Log gist: ## Description When editing Markdown, links to other files in the repo are relative to the location of the file. However, when previewing changes, the rendered preview seem to render links from the repository root. In the linked example, the link works as expected and links to https://try.gitea.io/testuser78944/test-markdown/src/branch/master/a/b/other.md. But try to edit the file and enable the preview mode: the link will be to https://try.gitea.io/testuser78944/test-markdown/src/branch/master/b/other.md instead (the `a/` part for the relative link is stripped). ## Screenshots ![image](https://user-images.githubusercontent.com/849031/73692234-d9868a80-46cb-11ea-9022-33c4ca29a5b2.png)
GiteaMirror added the issue/confirmedtype/bug labels 2025-11-02 06:02:44 -06:00
Author
Owner

@stale[bot] commented on GitHub (Apr 4, 2020):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Apr 4, 2020): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Author
Owner

@stale[bot] commented on GitHub (Apr 18, 2020):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (Apr 18, 2020): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4783