mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-07-07 20:30:28 +03:00
Fix a potential crash when translating with MinT
This commit is contained in:
parent
78fccc9578
commit
3bde1ae578
1 changed files with 5 additions and 2 deletions
|
@ -373,8 +373,11 @@ public class Translate {
|
||||||
//Retrieves the translated content
|
//Retrieves the translated content
|
||||||
String content;
|
String content;
|
||||||
try {
|
try {
|
||||||
content = URLDecoder.decode(translationJson.getString("translation"), "utf-8");
|
String data = translationJson.getString("translation");
|
||||||
} catch (UnsupportedEncodingException e) {
|
data = data.replaceAll("%(?![0-9a-fA-F]{2})", "%25");
|
||||||
|
data = data.replaceAll("\\+", "%2B");
|
||||||
|
content = URLDecoder.decode(data, "utf-8");
|
||||||
|
} catch (Exception e) {
|
||||||
content = translationJson.getString("translation");
|
content = translationJson.getString("translation");
|
||||||
}
|
}
|
||||||
translate.setTranslatedContent(content);
|
translate.setTranslatedContent(content);
|
||||||
|
|
Loading…
Reference in a new issue