From 9fad6b314f03d4e7e344e3c3f30fed1b08ad3ae7 Mon Sep 17 00:00:00 2001 From: Pavlo Kulyk Date: Thu, 26 Mar 2026 13:48:47 +0200 Subject: [PATCH] feat: add API for to determine our link or from a third-party source --- index.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/index.ts b/index.ts index 218d0fd..276e3dc 100644 --- a/index.ts +++ b/index.ts @@ -162,6 +162,22 @@ export default class UploadPlugin extends AdminForthPlugin { return { ok: true }; }; + async isInternalUrl(url: string): Promise { + const adapter = this.options.storageAdapter as any; + + if (adapter && typeof adapter.isInternalUrl === 'function') { + try { + return await adapter.isInternalUrl(url); + } catch (err) { + console.error(`[UploadPlugin] Error calling isInternalUrl on adapter:`, err); + return false; + } + } else { + throw new Error ('Plese update storage adapter') + } + return false; + } + instanceUniqueRepresentation(pluginOptions: any) : string { return `${pluginOptions.pathColumnName}`; }