1
0
mirror of https://github.com/LibreTranslate/LibreTranslate.git synced 2024-11-14 19:50:11 +01:00

Prevent div by zero

This commit is contained in:
Piero Toffanin 2023-11-15 15:02:23 -05:00
parent 80b510b1ad
commit a4a67b2b79

View File

@ -766,7 +766,7 @@ def create_app(args):
# set the cost of the request to N = bytes / char_limit, which is
# roughly equivalent to a batch process of N batches assuming
# each batch uses all available limits
if args.char_limit != -1:
if args.char_limit > 0:
request.req_cost = max(1, int(os.path.getsize(filepath) / args.char_limit))
translated_file_path = argostranslatefiles.translate_file(src_lang.get_translation(tgt_lang), filepath)