Closed
Description
Description
Since #19007, you can mark files in a PR as viewed.
Viewing an image, however, breaks viewing this image (see screenshots).
As soon as you de-view
the image and reload the page, everything works as expected.
Screenshots
Normal/ Expected
Error Case
Gitea Version
1.17.0+dev-546-g5ca224a78
Can you reproduce the bug on the Gitea demo site?
Yes
Operating System
Linux
Browser Version
Firefox 99
Activity
delvh commentedon Jun 8, 2022
I've gathered some additional information in the meantime, but I don't know how to fix it yet:

a) The screenshot above was for a SVG. "Luckily", this applies to images of all types, because I could confirm it with a PNG as well.
b) The reason for this issue is that both the enclosing span (and subsequently most likely through JS the image as well) get their width and height set to
0
:c) This leads me to assume that the width and height calculation fail because the image is not visible initially, and thus in good old JS fashion the calculated values default to 0 instead of throwing an error
I've looked through the corresponding code, but didn't find anything that looked as if it would support this hypothesis.
wxiaoguang commentedon Jun 8, 2022
I will take a look at it.
wxiaoguang commentedon Jun 8, 2022
Fix viewed images not loading in a PR (#19919)
Fix viewed images not loading in a PR (go-gitea#19919)