discourse/spec
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
..
fabricators DEV: Migrate user passwords data to UserPassword table (#28746) 2024-10-10 09:23:06 +08:00
fixtures DEV: Bump rubocop_discourse (#29608) 2024-11-06 06:27:49 +08:00
generator DEV: Silence the output of migration specs (#26365) 2024-03-26 11:32:44 +01:00
helpers DEV: Call Discourse.redis.flushdb after the end of each test (#29117) 2024-10-09 07:19:31 +08:00
import_export
initializers
integration DEV: Attempt to fix a flaky spec (#29155) 2024-10-10 17:19:53 +08:00
integrity DEV: Add spec to ensure app works with multiple tagged loggers 2024-08-13 18:10:03 +02:00
jobs DEV: Fix linting in notify_category_change_spec (#29175) 2024-10-11 19:55:33 +02:00
lib DEV: Enable the normalize_emails site setting by default (#29587) 2024-11-06 11:20:36 +08:00
mailers UX: Use a dropdown for SSL mode for group SMTP (#27932) 2024-07-18 10:33:14 +10:00
migrations DEV: Remove invalid content_security_policy_script_src site setting values from DB (#27588) 2024-06-27 22:17:56 +08:00
models DEV: Enable the normalize_emails site setting by default (#29587) 2024-11-06 11:20:36 +08:00
multisite FEATURE: allow admins to enable announced experimental features (#29244) 2024-10-22 10:56:58 +11:00
requests FIX: Pass upload type correctly to uploads#create (#29600) 2024-11-06 07:00:35 +03:00
script/import_scripts DEV: Catch missing translations during test runs (#26258) 2024-05-24 22:15:53 +08:00
serializers FEATURE - Add username column to custom emoji table (#29522) 2024-11-01 10:32:59 -05:00
services DEV: Remove hash-like access from service contracts 2024-10-29 16:02:51 +01:00
support DEV: Combine S3 system spec helpers into one (#29580) 2024-11-05 09:28:14 +10:00
system FIX: correctly display category name in replace text modal (#29612) 2024-11-06 13:39:52 +11:00
tasks DEV: Secure upload rake task improvements (#29484) 2024-10-31 13:33:11 +10:00
views FEATURE: Simplify crawler content for non-canonical post URLs (#26324) 2024-03-26 15:18:46 +00:00
rails_helper.rb Dev fix some types (#29547) 2024-11-01 19:19:25 +02:00
regenerate_swagger_docs
swagger_helper.rb