Skip to content

Commit 2d3b0ff

Browse files
committed
Scan through files for datacite.yml separately
The original loop breaks after finding a readme file, so if the readme is found before the datacite, the loop breaks and the datacite is never found. We could modify it so that it keeps running until the end, but I don't want to make bigger changes to the existing upstream code. It would also change the behaviour when there are multiple files that are detected as README files (which is a separate issue).
1 parent 986a337 commit 2d3b0ff

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

routes/repo/repo_gin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ func serveAnnexedData(ctx *context.Context, name string, cpt *captcha.Captcha, b
5050
}
5151

5252
func readDataciteFile(entry *git.TreeEntry, c *context.Context) {
53+
log.Trace("Found datacite.yml file")
5354
c.Data["HasDatacite"] = true
5455
doiData, err := entry.Blob().Data()
5556
if err != nil {

routes/repo/view.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ func renderDirectory(c *context.Context, treeLink string) {
5757
for _, entry := range entries {
5858
if !entry.IsDir() && entry.Name() == "datacite.yml" {
5959
readDataciteFile(entry, c)
60-
continue
60+
break
6161
}
62+
}
63+
for _, entry := range entries {
6264
if entry.IsDir() || !markup.IsReadmeFile(entry.Name()) {
6365
continue
6466
}

0 commit comments

Comments
 (0)