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

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.

Co-authored-by: jxshin <zhujiaxinabc@gmail.com>
(cherry picked from commit a63f14b90839821a480fb56fd9b45a27864b77d1)
This commit is contained in:
Jiaxin Zhu 2024-04-25 08:07:38 +08:00 committed by Earl Warren
parent bce70cc024
commit 93820d26ba
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 0579CB2928A78A00

View file

@ -68,6 +68,6 @@
{{end}}
</tbody>
</table>
{{if .ReadmeExist}}
{{if and .ReadmeExist (or .IsMarkup .IsPlainText)}}
{{template "repo/view_file" .}}
{{end}}