mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-16 20:40:10 +01:00
Fix string index out of range fault
This commit is contained in:
parent
a9bff7929c
commit
2972292fc5
@ -644,6 +644,7 @@ def create_app(args):
|
||||
}
|
||||
)
|
||||
except Exception as e:
|
||||
raise e
|
||||
abort(500, description=_("Cannot translate text: %(text)s", text=str(e)))
|
||||
|
||||
@bp.post("/translate_file")
|
||||
|
@ -107,6 +107,9 @@ def improve_translation_formatting(source, translation, improve_punctuation=True
|
||||
if source.isupper():
|
||||
return translation.upper()
|
||||
|
||||
if len(translation) == 0:
|
||||
return source
|
||||
|
||||
if source[0].islower():
|
||||
return translation[0].lower() + translation[1:]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user