mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Fix citation error when the file size is larger than 1024 bytes (#27958)
Mentioned in: https://github.com/go-gitea/gitea/pull/27931#issuecomment-1798016960 Same to #25131, so use the same method to fix this problem.
This commit is contained in:
		@@ -716,14 +716,11 @@ func checkCitationFile(ctx *context.Context, entry *git.TreeEntry) {
 | 
				
			|||||||
				return
 | 
									return
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			defer dataRc.Close()
 | 
								defer dataRc.Close()
 | 
				
			||||||
			buf := make([]byte, 1024)
 | 
								ctx.PageData["citationFileContent"], err = blob.GetBlobContent(setting.UI.MaxDisplayFileSize)
 | 
				
			||||||
			n, err := util.ReadAtMost(dataRc, buf)
 | 
					 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				ctx.ServerError("ReadAtMost", err)
 | 
									ctx.ServerError("GetBlobContent", err)
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			buf = buf[:n]
 | 
					 | 
				
			||||||
			ctx.PageData["citationFileContent"] = string(buf)
 | 
					 | 
				
			||||||
			break
 | 
								break
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user