Skip to content

Commit 3dc62b9

Browse files
committed
fix: enhance error handling for missing or misconfigured upload plugins in attachment fields
1 parent d56d8ff commit 3dc62b9

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

custom/VisionTable.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<img
2525
v-if="isValidUrl(image)"
2626
:src="image"
27-
class="w-20 h-20 object-cover rounded cursor-pointer border hover:border-blue-500 transition"
27+
class="w-20 h-20 object-cover rounded cursor-pointer border hover:border-blue-500 transition my-2"
2828
@click="zoomImage(image)"
2929
/>
3030
<div v-else class="w-20 h-20">
@@ -124,16 +124,16 @@
124124

125125
<div v-if="isAiResponseReceivedImage[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])]" @mouseenter="(() => { hovers[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] = true})" @mouseleave="(() => { hovers[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] = false})">
126126
<div v-if="isInColumnImage(n)">
127-
<div class="mt-2 flex items-center justify-start gap-2">
128-
<div v-if="isValidUrl(selected[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n])" class="flex flex-col items-center">
127+
<div class="mt-2 mb-2 flex items-center justify-start gap-2">
128+
<div v-if="isValidUrl(selected[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n])" class="flex flex-col items-center relative">
129129
<img
130130
:src="selected[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n]"
131131
class="w-20 h-20 object-cover rounded cursor-pointer border hover:border-blue-500 transition"
132132
@click="() => {openGenerationCarousel[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] = true}"
133133
/>
134134
<p
135135
v-if="isImageHasPreviewUrl[n]"
136-
class="mt-2 text-sm hover:text-blue-500 hover:underline hover:cursor-pointer flex items-center gap-1"
136+
class="absolute mt-20 text-sm hover:text-blue-500 hover:underline hover:cursor-pointer flex items-center gap-1"
137137
:class="{ 'opacity-0': !hovers[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] }"
138138
@click="() => {openImageCompare[tableColumnsIndexes.findIndex(el => el[primaryKey] === item[primaryKey])][n] = true}"
139139
>

index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,15 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
401401
p.resourceConfig!.resourceId === this.resourceConfig.resourceId &&
402402
p.pluginOptions.pathColumnName === key
403403
);
404+
if (!plugin) {
405+
throw new Error(`Plugin for attachment field '${key}' not found in resource '${this.resourceConfig.resourceId}', please check if Upload Plugin is installed on the field ${key}`);
406+
}
407+
if (!plugin.pluginOptions.storageAdapter.objectCanBeAccesedPublicly()) {
408+
throw new Error(`Upload Plugin for attachment field '${key}' in resource '${this.resourceConfig.resourceId}'
409+
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.
410+
Please configure adapter in such way that it will store objects publicly (e.g. for S3 use 'public-read' ACL).
411+
`);
412+
}
404413
outputImagesPluginInstanceIds[key] = plugin.pluginInstanceId;
405414
}
406415
}

0 commit comments

Comments
 (0)