Skip to content

Commit 0d470e3

Browse files
committed
fix: add check for the preview Url option in isInternalUrl method
1 parent ff111f2 commit 0d470e3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,15 @@ export default class UploadPlugin extends AdminForthPlugin {
164164

165165
async isInternalUrl(url: string): Promise<boolean> {
166166
const adapter = this.options.storageAdapter as any;
167-
168167
if (adapter && typeof adapter.isInternalUrl === 'function') {
169168
try {
169+
if(this.options.preview?.previewUrl) {
170+
const previewUrl = this.options.preview.previewUrl({ filePath: 'test_filepath' });
171+
if (url.startsWith(previewUrl.replace('test_filepath', ''))) {
172+
return true;
173+
}
174+
return false;
175+
}
170176
return await adapter.isInternalUrl(url);
171177
} catch (err) {
172178
console.error(`[UploadPlugin] Error calling isInternalUrl on adapter:`, err);

0 commit comments

Comments
 (0)