mirror of
				https://github.com/LibreTranslate/LibreTranslate.git
				synced 2025-10-31 10:37:13 -04:00 
			
		
		
		
	Merge pull request #216 from fushinari/suggest-errors
suggestions: Abort when missing parameters
This commit is contained in:
		
						commit
						ea332b11e6
					
				| @ -903,6 +903,15 @@ def create_app(args): | |||||||
|         source_lang = request.values.get("source") |         source_lang = request.values.get("source") | ||||||
|         target_lang = request.values.get("target") |         target_lang = request.values.get("target") | ||||||
| 
 | 
 | ||||||
|  |         if not q: | ||||||
|  |             abort(400, description="Invalid request: missing q parameter") | ||||||
|  |         if not s: | ||||||
|  |             abort(400, description="Invalid request: missing s parameter") | ||||||
|  |         if not source_lang: | ||||||
|  |             abort(400, description="Invalid request: missing source parameter") | ||||||
|  |         if not target_lang: | ||||||
|  |             abort(400, description="Invalid request: missing target parameter") | ||||||
|  | 
 | ||||||
|         SuggestionsDatabase().add(q, s, source_lang, target_lang) |         SuggestionsDatabase().add(q, s, source_lang, target_lang) | ||||||
|         return jsonify({"success": True}) |         return jsonify({"success": True}) | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user