Making doc extraction more reliable (#17842)
* Making doc extraction more reliable * fix error message * Adding test doc file * Removing test that not works on CI because the lack of a binary Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0f07a934ff
Коммит
b9cceb70ae
@@ -31,7 +31,14 @@ func (de *documentExtractor) Match(filename string) bool {
|
||||
return ok
|
||||
}
|
||||
|
||||
func (de *documentExtractor) Extract(filename string, r io.ReadSeeker) (string, error) {
|
||||
func (de *documentExtractor) Extract(filename string, r io.ReadSeeker) (out string, outErr error) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
out = ""
|
||||
outErr = errors.New("error extracting document text")
|
||||
}
|
||||
}()
|
||||
|
||||
extension := strings.TrimPrefix(path.Ext(filename), ".")
|
||||
converter, ok := doconvConverterByExtensions[extension]
|
||||
if !ok {
|
||||
|
||||
Ссылка в новой задаче
Block a user