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

Relative image paths in readmes are incorrect #10412

Closed
1 of 7 tasks
SuperSandro2000 opened this issue Feb 22, 2020 · 7 comments
Closed
1 of 7 tasks

Relative image paths in readmes are incorrect #10412

SuperSandro2000 opened this issue Feb 22, 2020 · 7 comments
Labels
issue/duplicate The issue has already been reported.

Comments

@SuperSandro2000
Copy link
Contributor

SuperSandro2000 commented Feb 22, 2020

  • Gitea version (or commit ref): 1.12.0+dev-354-gc8d1c3812
  • Git version: irrelevant
  • Operating system: Debian
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

When I visit https://try.gitea.io/supersandro2000/hacker-laws I get a 404 for a missing embedded image in the readme. The image is embedded like this <img width="480px" alt="Diagram: Amdahl's Law" src="./images/amdahls_law.png" /> and it resolves that to https://try.gitea.io/supersandro2000/images/amdahls_law.png which is not correct. The repository is a mirror of https://github.com/dwmkerr/hacker-laws.git .

When I open the readme file directly it gets resolved correctly.

Also this triggers a http basic auth on my private instance cause I think some api request has that activated.

Screenshots

@silverwind
Copy link
Member

The issues is that the relative link resolves to https://try.gitea.io/supersandro2000/hacker-laws/src/branch/master/images/amdahls_law.png which is the /src/ page while it should use /raw/ for the actual image resource.

@SuperSandro2000
Copy link
Contributor Author

You are right. So it does not work either way.

@zeripath
Copy link
Contributor

@SuperSandro2000

In fact you should not be using the ./raw endpoint you should use the ./media endpoint as that will transparently work for LFS.

Now if you want to link to an image the simplest thing is to use the ![Diagram: Amdahl's Law](images/amdahls_law.png)

That being said we can do something better with detecting image links. So we should really make these links relative to the media link.

I wonder if the /media link of a markdown file should actually just render the markdown.

@SuperSandro2000
Copy link
Contributor Author

This is not my repo. I just mirrored it from GitHub and I get greeted with a basic auth pop up all the time when I visit it on my private instance and only when I am not logged in on the demo instance. The pop up is the only reason why I reported this as it is very annoying and disrupts the user.

@silverwind
Copy link
Member

In fact you should not be using the ./raw endpoint you should use the ./media endpoint as that will transparently work for LFS.

I'd expect ./image.png links to files in the repo to resolve to the raw endpoint. If the file has a URL in LFS, it could be used instead, but generally the user should not have to care whether LFS is enabled or not so those images work everywhere.

@6543
Copy link
Member

6543 commented Feb 24, 2020

this is a dublicate of #8830

@guillep2k guillep2k added the issue/duplicate The issue has already been reported. label Feb 25, 2020
@guillep2k
Copy link
Member

Close in favor of #8830

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/duplicate The issue has already been reported.
Projects
None yet
Development

No branches or pull requests

5 participants