Created by: KrugarValdes
Reason
- Synology API successfully accepted photo uploads, but the response format changed and our code could not deserialize it. As a result, the upload returned an error and no reaction was posted under the Mattermost message.
- The previous implementation incorrectly used @Body with a manually built multipart request. Synology requires a proper multipart/form-data request with parameters passed as parts, not in the body.
Solution
- API interface update: Switched uploadPhoto in SynologyApi to a proper @Multipart endpoint (/entry.cgi?api=SYNO.Foto.Upload.Item&method=upload&version=1)
- Repository refactor:
- Removed manual multipart builder and header‑stripping hack.
- Added setRequestToUpload(file, fileName, fileType) to prepare the three parts (file, name, duplicate)
- Updated uploadPhoto to call the new multipart method, then manually read ResponseBody, and parse JSON with Moshi into UploadPhotoResponse
Result Photos are uploaded to Synology and the JSON response is parsed without errors. The repository now correctly recognizes a successful upload and triggers the reaction under the Mattermost post.