Skip to content

Commit 9fad6b3

Browse files
committed
feat: add API for to determine our link or from a third-party source
1 parent d8423ec commit 9fad6b3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

index.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,22 @@ export default class UploadPlugin extends AdminForthPlugin {
162162
return { ok: true };
163163
};
164164

165+
async isInternalUrl(url: string): Promise<boolean> {
166+
const adapter = this.options.storageAdapter as any;
167+
168+
if (adapter && typeof adapter.isInternalUrl === 'function') {
169+
try {
170+
return await adapter.isInternalUrl(url);
171+
} catch (err) {
172+
console.error(`[UploadPlugin] Error calling isInternalUrl on adapter:`, err);
173+
return false;
174+
}
175+
} else {
176+
throw new Error ('Plese update storage adapter')
177+
}
178+
return false;
179+
}
180+
165181
instanceUniqueRepresentation(pluginOptions: any) : string {
166182
return `${pluginOptions.pathColumnName}`;
167183
}

0 commit comments

Comments
 (0)