mirror of
				https://github.com/LibreTranslate/LibreTranslate.git
				synced 2025-11-04 03:27:14 -05:00 
			
		
		
		
	Prevent div by zero
This commit is contained in:
		
							parent
							
								
									80b510b1ad
								
							
						
					
					
						commit
						a4a67b2b79
					
				@ -766,7 +766,7 @@ def create_app(args):
 | 
				
			|||||||
            # set the cost of the request to N = bytes / char_limit, which is
 | 
					            # set the cost of the request to N = bytes / char_limit, which is
 | 
				
			||||||
            # roughly equivalent to a batch process of N batches assuming
 | 
					            # roughly equivalent to a batch process of N batches assuming
 | 
				
			||||||
            # each batch uses all available limits
 | 
					            # 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))
 | 
					                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)
 | 
					            translated_file_path = argostranslatefiles.translate_file(src_lang.get_translation(tgt_lang), filepath)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user