mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-04-21 14:39:23 +00: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> (cherry picked from commit b956cee06f462c4f34a7911351b7c878ce890725)
This commit is contained in:
parent
839739fb71
commit
9d8624f341
1 changed files with 2 additions and 1 deletions
|
@ -179,7 +179,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 {
|
||||||
|
|
Loading…
Add table
Reference in a new issue