You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 189643b
Browse filesBrowse the repository at this point in the historyBrowse files
docs: strict content type AdminForth/2032/fix-upload-plugin-and-storage-
Storage adapters: strictContentType option of the S3 adapters. Upload
plugin API: the examples send the contentType returned with the upload
URL, and size has to be the real size of the file.
Stores uploaded files in [Amazon S3](https://aws.amazon.com/s3/), providing scalable cloud storage.
18
18
19
+
### Strict content type
20
+
21
+
The upload plugin picks the content type of a file by its extension, e.g. `image/png` for `.png`. By default S3 does not check it on upload, so a client can store a file with any `Content-Type`, e.g. `text/html` under a `.png` key, and the browser will open it as a page. Set `strictContentType: true` to sign the content type into the upload URL, then an upload with another type is rejected:
Before turning it on, update `@adminforth/bulk-ai-flow`, `@adminforth/markdown`, `@adminforth/rich-editor` and `@adminforth/oauth`: their older versions send the type reported by the browser, and the upload fails when it differs from the one picked by the extension. Your own code that uploads files to the URL from the [upload plugin API](../09-Plugins/05-1-upload-api.md) has to send the `contentType` returned with the URL as well. While the option is off, the adapter logs a warning on start. It will be on by default in the next major version.
Provides S3 compatible interface for object storage services such as MinIO, Wasabi, Cloudflare R2 or other third-party S3 providers.
41
+
42
+
It supports the same `strictContentType` option as the Amazon S3 adapter, see [Strict content type](#strict-content-type).
43
+
25
44
### How the adapter works
26
45
27
46
The Amazon S3 adapter uses tagging to mark objects with the special tag `adminforth-candidate-for-cleanup`, and then creates a lifecycle rule that automatically expires objects with that tag.
0 commit comments