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

Fix view of readme file in the home code page. #30564

Merged
merged 2 commits into from
Apr 25, 2024
Merged

Conversation

jxshin
Copy link
Contributor

@jxshin jxshin commented Apr 18, 2024

Gitea attempts to display image file, pdf file, etc. named readme in the home code page (but it cannot).
I think only the markdown and plain-text file should be displayed, which is also the behavior of GitHub.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 18, 2024
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Apr 18, 2024
@github-actions github-actions bot added the modifies/templates This PR modifies the template files label Apr 18, 2024
@silverwind
Copy link
Member

Maybe we could also make the code more clear and rename readmeExist and ReadmeExist variables to isReadmeFileName and IsReadmeFileName which would make it more clear that the check is only for the filename.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 18, 2024
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 20, 2024
@lunny
Copy link
Member

lunny commented Apr 21, 2024

Can an image png/svg be a README?

@jxshin
Copy link
Contributor Author

jxshin commented Apr 21, 2024

Can an image png/svg be a README?

Hi, @lunny!
In most cases, it is not, but README.png / README.svg / README.pdf exists.
Examples:
funny/fastway
CYENS/ReinheritArApp

@silverwind
Copy link
Member

silverwind commented Apr 21, 2024

It seems GitHub's behaviour is to render the file as long as it's plaintext.

https://github.com/CYENS/ReinheritArApp/blob/main/docs/Readme.pdf does appear strange because the displayed size (840kB) does not match the actual file size (131 bytes).

@lunny
Copy link
Member

lunny commented Apr 22, 2024

It seems GitHub's behaviour is to render the file as long as it's plaintext.

https://github.com/CYENS/ReinheritArApp/blob/main/docs/Readme.pdf does appear strange because the displayed size (840kB) does not match the actual file size (131 bytes).

It's a LFS file.

@silverwind
Copy link
Member

It seems GitHub's behaviour is to render the file as long as it's plaintext.
https://github.com/CYENS/ReinheritArApp/blob/main/docs/Readme.pdf does appear strange because the displayed size (840kB) does not match the actual file size (131 bytes).

It's a LFS file.

Ah, so that's an LFS pointer which is plaintext, but GitHub does not support rendering the actual LFS file.

@silverwind silverwind added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 24, 2024
@silverwind silverwind enabled auto-merge (squash) April 24, 2024 23:40
@silverwind silverwind merged commit a63f14b into go-gitea:main Apr 25, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.23.0 milestone Apr 25, 2024
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 25, 2024
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 25, 2024
* giteaofficial/main:
  If a repository return no commitstatus, then still cache it but not query it from database (go-gitea#30700)
  [skip ci] Updated translations via Crowdin
  Fix view of readme file in the home code page. (go-gitea#30564)
  Add test for go-gitea#30674 (go-gitea#30679)
  Fix border-radius of header+segment boxes (go-gitea#30667)
@wxiaoguang wxiaoguang modified the milestones: 1.23.0, 1.22.0 Apr 27, 2024
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jul 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/templates This PR modifies the template files size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants