diff --git a/app/src/main/java/com/h/pixeldroid/postCreation/PostCreationActivity.kt b/app/src/main/java/com/h/pixeldroid/postCreation/PostCreationActivity.kt index 1618f084..a3052b95 100644 --- a/app/src/main/java/com/h/pixeldroid/postCreation/PostCreationActivity.kt +++ b/app/src/main/java/com/h/pixeldroid/postCreation/PostCreationActivity.kt @@ -284,7 +284,11 @@ class PostCreationActivity : BaseActivity() { } var postSub: Disposable? = null - val inter = pixelfedAPI.mediaUpload("Bearer $accessToken", data.imageDescription, requestBody.parts[0]) + + val description = data.imageDescription?.let { MultipartBody.Part.createFormData("description", it) } + + + val inter = pixelfedAPI.mediaUpload("Bearer $accessToken", description, requestBody.parts[0]) postSub = inter .subscribeOn(Schedulers.io()) diff --git a/app/src/main/java/com/h/pixeldroid/utils/api/PixelfedAPI.kt b/app/src/main/java/com/h/pixeldroid/utils/api/PixelfedAPI.kt index d79392b8..e92a1ee0 100644 --- a/app/src/main/java/com/h/pixeldroid/utils/api/PixelfedAPI.kt +++ b/app/src/main/java/com/h/pixeldroid/utils/api/PixelfedAPI.kt @@ -256,7 +256,7 @@ interface PixelfedAPI { fun mediaUpload( //The authorization header needs to be of the form "Bearer " @Header("Authorization") authorization: String, - @Part("description") description: String?, + @Part description: MultipartBody.Part? = null, @Part file: MultipartBody.Part ): Observable