discourse/app
Osama Sayegh 6f8f6a7726
FIX: Pass upload type correctly to uploads#create (#29600)
Prior to Uppy, the `uploads#create` endpoint used to receive a `type` param that indicated the purpose/target of the upload, such as `avatar`, `site_setting` and so on. With the introduction of Uppy, the `type` param became the MIME type of the file being uploaded, and the purpose/target of the upload became a new param called `upload_type`, however the backend could still use the `type` param (which now contains MIME type) as the purpose/target of the upload if `upload_type` is absent.

We technically don't need to send the MIME type over the network, but it seems like it's done by Uppy and we have no control over the `type` param that Uppy includes:

758de8167b/app/assets/javascripts/discourse/app/lib/uppy/uppy-upload.js (L146-L151)

This commit does a couple of things:

1. It amends the `uploads#create` endpoint so it always requires the `upload_type` param and doesn't fallback to `type` if `upload_type` is absent
2. It forces consumers of the `UppyUpload` class (and by extension `UppyImageUploader`) to specify `type` of the upload

Internal topic: t/140945.
2024-11-06 07:00:35 +03:00
..
assets FIX: Pass upload type correctly to uploads#create (#29600) 2024-11-06 07:00:35 +03:00
controllers FIX: Pass upload type correctly to uploads#create (#29600) 2024-11-06 07:00:35 +03:00
helpers DEV: Drop WithServiceHelper 2024-09-05 09:58:20 +02:00
jobs DEV: Remove logical OR assignment of constants (#29201) 2024-10-16 10:09:07 +08:00
mailers UX: Use a dropdown for SSL mode for group SMTP (#27932) 2024-07-18 10:33:14 +10:00
models DEV: Fetch settings by area name instead of individual settings (#29604) 2024-11-06 06:56:27 +03:00
serializers FEATURE - Add username column to custom emoji table (#29522) 2024-11-01 10:32:59 -05:00
services DEV: Bump rubocop_discourse (#29608) 2024-11-06 06:27:49 +08:00
views FEATURE: Enable the new /about page for everyone (#29390) 2024-10-29 18:40:11 +03:00