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

Only first embedded image get correctly resolved to media/branch #11482

Closed
CMiksche opened this issue May 18, 2020 · 11 comments · Fixed by #10515
Closed

Only first embedded image get correctly resolved to media/branch #11482

CMiksche opened this issue May 18, 2020 · 11 comments · Fixed by #10515
Labels
issue/duplicate The issue has already been reported.
Milestone

Comments

@CMiksche
Copy link

Im am writing this issue because #10484 and #10506 are closed but the issue isn't fixed.

Description

When you embed images only the first embedded image is shown.

E.g.:

![Coverage Branches](./coverage/badge-branches.png)
![Coverage Lines](./coverage/badge-lines.png)
![Coverage Functions](./coverage/badge-functions.png)
![Coverage Statements](./coverage/badge-statements.png)

Only my Coverage Branches gets resolved to media/branch the other images are resolved to a src/branch URL.

I didn't had this problem with old versions from Gitea, but since i upgraded to version 1.11.5 i have this problem too ... (i think i hadn't had this problem with 1.10.4)

Screenshots

gitea_img_resolve

@CMiksche
Copy link
Author

#10515 and the file gitea/modules/markup/html.go should be interesting for debugging i think either visitNode() don't get called on the following elements (with the wrong url path) or some condition in visitNode() is wrong?!

I don't know how big a node is and what the delimiters are which make a node but maybe the block without a break is one node and because there is strings.Replace(prefix, "/src/", "/media/", 1) it only replaces one URL (because of the "1" in the function call)?!

@zeripath
Copy link
Contributor

@CMiksche does this occur on try?

@CMiksche
Copy link
Author

CMiksche commented May 19, 2020

@CMiksche does this occur on try?

What do you exactly mean?

I haven't looked further into debugging but i can definitely say there is a problem with the html markup creation. The first element also gets a link around it:

<p><a href="/<my repo>/media/branch/master/coverage/badge-branches.png" rel=""><img src="/<my repo>/media/branch/master/coverage/badge-branches.png" alt="Coverage Branches"></a>
<img src="./coverage/badge-lines.png" alt="Coverage Lines">
<img src="./coverage/badge-functions.png" alt="Coverage Functions">
<img src="./coverage/badge-statements.png" alt="Coverage Statements"></p>

But the markdown is exactly the same on all lines:

![Coverage Branches](./coverage/badge-branches.png)
![Coverage Lines](./coverage/badge-lines.png)
![Coverage Functions](./coverage/badge-functions.png)
![Coverage Statements](./coverage/badge-statements.png)

@zeripath
Copy link
Contributor

zeripath commented May 19, 2020

No I mean do you have an example on try.gitea.io where this does not work.

For example both test cases on the PRs you quote above work on try.gitea.io.

I'm trying to determine if this is fixed on master/1.12 already.

@zeripath
Copy link
Contributor

This is fixed on 1.12 - the issue is that #10515 is not backported to 1.11 - I'll open a backport for it now.

@zeripath zeripath added this to the 1.12.0 milestone May 19, 2020
@CMiksche
Copy link
Author

I created a test at https://try.gitea.io/cmiksche/test-multiple-local-badges/src/branch/master/README.md

test

I used the same markdown code which i use to display the badges next to each other on my current gitea instance and on github. Why are the badges displayed below each other?!

@zeripath zeripath added the issue/duplicate The issue has already been reported. label May 19, 2020
@CMiksche
Copy link
Author

I used the same markdown code which i use to display the badges next to each other on my current gitea instance and on github. Why are the badges displayed below each other?!

Okay, i got it - i have to write the markdown in the next version next to each other to get that result ...

@zeripath Thanks for fixing :-)

@zeripath
Copy link
Contributor

The problem is #11162 switched us to use hard breaks by default.

Looking at it I suspect that selection was incorrect - we should try to render as much as we can like GH.

@zeripath
Copy link
Contributor

Yup I think that PR is incorrect.

@zeripath
Copy link
Contributor

OK it looks like GH has two different styles - Markdown files have Soft breaks, comments have Hard breaks. I've put up a PR to fix this.

@CMiksche
Copy link
Author

CMiksche commented Jun 2, 2020

I tested the new version and my problems are fixed. I close this issue now ;-)

@CMiksche CMiksche closed this as completed Jun 2, 2020
@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

Successfully merging a pull request may close this issue.

2 participants