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 link on different branch broken for github migrations / mirrors #25632

Open
throwabird opened this issue Jul 2, 2023 · 2 comments
Labels

Comments

@throwabird
Copy link

throwabird commented Jul 2, 2023

Description

When migrating a repository from GitHub to Gitea. Links to an image in the README of the main branch that reference an image located on another branch don't link correctly on Gitea.

For Example: https://github.com/hlissner/dotfiles references images in the README that are located on the screenshots branch. After the migration they don't render correctly on the Gitea repository. See https://try.gitea.io/oonguphuu5og3OovishooVie/master.

The failures in the log during the migration:

...eb/routing/logger.go:102:func1() [I] router: completed GET /REDACTED/master for REDACTED, 200 OK in 71.8ms @ repo/view.go:710(repo.Home)
...eb/routing/logger.go:102:func1() [I] router: completed GET /screenshots/alucard/fakebusy.png for REDACTED, 404 Not Found in 1.5ms @ web/goget.go:20(web.goGet)
...eb/routing/logger.go:102:func1() [I] router: completed GET /screenshots/alucard/desktop.png for REDACTED, 404 Not Found in 1.6ms @ web/goget.go:20(web.goGet)
...eb/routing/logger.go:102:func1() [I] router: completed GET /screenshots/alucard/rofi.png for REDACTED, 404 Not Found in 1.7ms @ web/goget.go:20(web.goGet)
...eb/routing/logger.go:102:func1() [I] router: completed GET /screenshots/alucard/tiling.png for REDACTED, 404 Not Found in 1.8ms @ web/goget.go:20(web.goGet)

Gitea Version

1.20.0+rc2

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

image

Git Version

Try Gitea version

Operating System

Docker

How are you running Gitea?

https://try.gitea.io/ and Docker version

Database

SQLite

@CaiCandong
Copy link
Member

CaiCandong commented Jul 13, 2023

I was also able to reproduce the error, but when I use the tags in markdown, I am able to see the image displayed normally.
![img](/../screenshots/alucard/desktop.png)

The issue is similar to #15075.

@KN4CK3R
Copy link
Member

KN4CK3R commented Aug 28, 2023

At the moment I would say Github is weird in this case.

The readme file contains
<img src="/../screenshots/alucard/fakebusy.png" width="100%" />
Github renders the final link as
<img src="/hlissner/dotfiles/raw/screenshots/alucard/fakebusy.png" />
They use
/<owner>/<repo>/raw/<branch>
as base url.
If you "add" the absolute path
/../screenshots/alucard/fakebusy.png
to
/hlissner/dotfiles/raw/main
the result is
/screenshots/alucard/fakebusy.png
I would understand what they are doing if the image would be the relative path
../screenshots/alucard/fakebusy.png (the missing first slash)
The .. removes main from the path and appends screenshots/alucard/fakebusy.png

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

Successfully merging a pull request may close this issue.

3 participants