Skip to content

Commit e497404

Browse files
committed
fix: update S3 upload URL path and improve error message for attachment field configuration
1 parent 5003191 commit e497404

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

custom/MarkdownEditor.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ async function uploadFileToS3(file: File) {
143143
const originalExtension = file.name.split('.').pop();
144144
145145
const { uploadUrl, tagline, previewUrl, s3Path, error } = await callAdminForthApi({
146-
path: `/plugin/${props.meta.uploadPluginInstanceId}/get_s3_upload_url`,
146+
path: `/plugin/${props.meta.uploadPluginInstanceId}/get_file_upload_url`,
147147
method: 'POST',
148148
body: {
149149
originalFilename,

index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ export default class MarkdownPlugin extends AdminForthPlugin {
6161
throw new Error(`${plugin} Plugin for attachment field '${this.options.attachments!.attachmentFieldName}' not found in resource '${this.options.attachments!.attachmentResource}', please check if Upload Plugin is installed on the field ${this.options.attachments!.attachmentFieldName}`);
6262
}
6363

64-
if (plugin.pluginOptions.s3ACL !== 'public-read') {
64+
if (!plugin.pluginOptions.storageAdapter.objectCanBeAccesedPublicly()) {
6565
throw new Error(`Upload Plugin for attachment field '${this.options.attachments!.attachmentFieldName}' in resource '${this.options.attachments!.attachmentResource}'
66-
should have s3ACL set to 'public-read' (in vast majority of cases signed urls inside of HTML text is not desired behavior, so we did not implement it)`);
66+
uses adapter which is not configured to store objects in public way, so it will produce only signed private URLs which can not be used in HTML text of blog posts.
67+
Please configure adapter in such way that it will store objects publicly (e.g. for S3 use 'public-read' ACL).
68+
`);
6769
}
6870
this.uploadPlugin = plugin;
6971
}

0 commit comments

Comments
 (0)