mirror of
https://github.com/go-gitea/gitea.git
synced 2025-04-22 01:18:45 +03:00
Fix file name could not be searched if the file was not a text file when using the Bleve indexer (#33959)
Close #33828 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@ -191,7 +191,8 @@ func (b *Indexer) addUpdate(ctx context.Context, batchWriter git.WriteCloserErro
|
|||||||
return err
|
return err
|
||||||
} else if !typesniffer.DetectContentType(fileContents).IsText() {
|
} else if !typesniffer.DetectContentType(fileContents).IsText() {
|
||||||
// FIXME: UTF-16 files will probably fail here
|
// FIXME: UTF-16 files will probably fail here
|
||||||
return nil
|
// Even if the file is not recognized as a "text file", we could still put its name into the indexers to make the filename become searchable, while leave the content to empty.
|
||||||
|
fileContents = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err = batchReader.Discard(1); err != nil {
|
if _, err = batchReader.Discard(1); err != nil {
|
||||||
|
Reference in New Issue
Block a user