mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-29 12:27:11 +01:00
Fix bug with inserting malformed image links
This commit is contained in:
parent
0e31e40ef1
commit
495a1d025f
@ -49,7 +49,11 @@ public class UploadImageUtils {
|
|||||||
if (uploadMediaResponse.isSuccessful()) {
|
if (uploadMediaResponse.isSuccessful()) {
|
||||||
JSONObject responseObject = new JSONObject(uploadMediaResponse.body());
|
JSONObject responseObject = new JSONObject(uploadMediaResponse.body());
|
||||||
String fileName = responseObject.getJSONArray("files").getJSONObject(0).getString("file");
|
String fileName = responseObject.getJSONArray("files").getJSONObject(0).getString("file");
|
||||||
return mRetrofit.getBaseURL() + "/pictrs/image/" + fileName;
|
String baseURL = mRetrofit.getBaseURL();
|
||||||
|
if (baseURL.endsWith("/")) {
|
||||||
|
baseURL = baseURL.substring(0, baseURL.length() - 1);
|
||||||
|
}
|
||||||
|
return baseURL + "/pictrs/image/" + fileName;
|
||||||
} else {
|
} else {
|
||||||
return "Error: " + uploadMediaResponse.code();
|
return "Error: " + uploadMediaResponse.code();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user