Fix object does not exist error when checking citation file (#28314)
Fix #28264 `DataAsync()` will be called twice. Caused by https://github.com/go-gitea/gitea/pull/27958. I'm sorry, I didn't completely remove all unnecessary codes.
This commit is contained in:
parent
09d5028442
commit
ec90ee61ef
1 changed files with 6 additions and 13 deletions
|
@ -711,23 +711,16 @@ func checkCitationFile(ctx *context.Context, entry *git.TreeEntry) {
|
||||||
}
|
}
|
||||||
for _, entry := range allEntries {
|
for _, entry := range allEntries {
|
||||||
if entry.Name() == "CITATION.cff" || entry.Name() == "CITATION.bib" {
|
if entry.Name() == "CITATION.cff" || entry.Name() == "CITATION.bib" {
|
||||||
ctx.Data["CitiationExist"] = true
|
|
||||||
// Read Citation file contents
|
// Read Citation file contents
|
||||||
blob := entry.Blob()
|
if content, err := entry.Blob().GetBlobContent(setting.UI.MaxDisplayFileSize); err != nil {
|
||||||
dataRc, err := blob.DataAsync()
|
log.Error("checkCitationFile: GetBlobContent: %v", err)
|
||||||
if err != nil {
|
} else {
|
||||||
ctx.ServerError("DataAsync", err)
|
ctx.Data["CitiationExist"] = true
|
||||||
return
|
ctx.PageData["citationFileContent"] = content
|
||||||
}
|
|
||||||
defer dataRc.Close()
|
|
||||||
ctx.PageData["citationFileContent"], err = blob.GetBlobContent(setting.UI.MaxDisplayFileSize)
|
|
||||||
if err != nil {
|
|
||||||
ctx.ServerError("GetBlobContent", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Home render repository home page
|
// Home render repository home page
|
||||||
|
|
Loading…
Reference in a new issue