-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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 multiple readme file rendering and fix #1657 #1658
Conversation
continue | ||
} | ||
|
||
// TODO: collect all possible README files and show with priority. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was in the TODO list. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This PR will finish the TODO.
routers/repo/view.go
Outdated
if readmeFile != nil { | ||
if len(readmes) > 0 { | ||
var readmeFile *git.Blob | ||
for _, readme := range readmes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why re-loop if we stop at first ok. This could be done directly in the first loop at https://github.com/lunny/gitea/blob/d0ddef4e095a8f4e317a6163cb2e955fea254779/routers/repo/view.go#L67 for example ?
This just add an additional test if the file is a good filetype so no need to save them in an array ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that this add another point that it default to even "bad filetype" if not one good is found.
But this could be implemented directly in the first loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example in first loop setting directly readmeFile and do directly after
if tp != "" {
break
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sapk you are right. The type
will check which parser could read the README file according ext name. But we also need support README
, which should be rendered as a TEXT, so the tp
may be empty. But README
or README.diskdefine
is lower priority than README.md
or README.org
(this will be implemented at #1527).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
LGTM |
LGTM |
will fix #1657