Skip to content

Commit b956cee

Browse files
Fix file name could not be searched if the file was not a text file when using the Bleve indexer (go-gitea#33959)
Close go-gitea#33828 --------- Co-authored-by: wxiaoguang <[email protected]>
1 parent 279473f commit b956cee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

modules/indexer/code/bleve/bleve.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ func (b *Indexer) addUpdate(ctx context.Context, batchWriter git.WriteCloserErro
191191
return err
192192
} else if !typesniffer.DetectContentType(fileContents).IsText() {
193193
// FIXME: UTF-16 files will probably fail here
194-
return nil
194+
// 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.
195+
fileContents = nil
195196
}
196197

197198
if _, err = batchReader.Discard(1); err != nil {

0 commit comments

Comments
 (0)