0
0
Fork 0

Fix inability to use local LibreTranslate without setting ALLOWED_PRIVATE_ADDRESSES (#21926)

Fixes #20029
This commit is contained in:
Claire 2022-12-15 17:04:38 +01:00 committed by GitHub
parent bbc49f15e0
commit 673c54f114
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -27,7 +27,7 @@ class TranslationService::LibreTranslate < TranslationService
def request(text, source_language, target_language)
body = Oj.dump(q: text, source: source_language.presence || 'auto', target: target_language, format: 'html', api_key: @api_key)
req = Request.new(:post, "#{@base_url}/translate", body: body)
req = Request.new(:post, "#{@base_url}/translate", body: body, allow_local: true)
req.add_headers('Content-Type': 'application/json')
req
end