Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug/Feature Request] Markdown parse Relative Links #8830

Closed
6543 opened this issue Nov 4, 2019 · 7 comments · Fixed by #10515
Closed

[Bug/Feature Request] Markdown parse Relative Links #8830

6543 opened this issue Nov 4, 2019 · 7 comments · Fixed by #10515

Comments

@6543
Copy link
Member

6543 commented Nov 4, 2019

Version: 1.11.0+dev-163-g86a44f6b4

Support Relative Links

for example:
![picture](img/00.png)
currently: https://<gitea-instance/<user>/img/00.png
how it should be: https://<gitea-instance/<user>/s/raw/branch/<branch>/img/00.png

we also should parse something like:
this: <img src="metadata/en-US/phoneScreenshots/02.png" width="200" />
to: <img src="https://<gitea-instance/<user>/s/raw/branch/<branch>/metadata/en-US/phoneScreenshots/02.png" width="200" />

since other github and gitlab? support this avter repo migration lot of broken links hapen ...

@6543
Copy link
Member Author

6543 commented Nov 4, 2019

related to: #8813

@6543 6543 changed the title [Bug/Feature Request] Markdown parse [Bug/Feature Request] Markdown parse Relative Links Nov 4, 2019
@guillep2k
Copy link
Member

guillep2k commented Nov 5, 2019

It can be done. I wonder what are the possible ramifications (e.g. is there any security concern?); it shouldn't use the branch but the commit sha, I guess.

@pztrn
Copy link

pztrn commented Nov 28, 2019

In Gitlab for example specifying:

[the text](/the/url)

link will be rendered with root prefix (branch, commit SHA, etc), so URL will be valid in any mode (commit, branch viewing).

Right now it doesn't do prefixing and links are unusable (will get 404 when trying to load it). See my Gitea instance running 1.10.0 as example, "This is a snip from example configuration file" phrase, it contains unusable link.

@stale
Copy link

stale bot commented Jan 27, 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 stale bot added the issue/stale label Jan 27, 2020
@6543
Copy link
Member Author

6543 commented Jan 27, 2020

still not solved

@stale stale bot removed the issue/stale label Jan 27, 2020
@zeripath
Copy link
Contributor

What do we make the links absolute to and how do we determine that?

There are multiple places that markdown is rendered.

We'd either need to have a set path that a markdown path is relative to (likely different for each type of markdown) or need to detect the relative path at the time of saving and absolute it. We would need to be careful about how we send the absolute path to the renderer over the API too.

It's not an insurmountable problem but it does need a bit of thought.

@guillep2k
Copy link
Member

What do we make the links absolute to and how do we determine that?

We could have different repo meta contexts. The repo meta drives the creation of links and such.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants