From fce1c44c68e06be6f82b4c1cb7c5a3ad1f7df847 Mon Sep 17 00:00:00 2001 From: undefined Date: Mon, 10 Apr 2023 21:49:27 +0800 Subject: [PATCH] core: storage: fix aliyun-oss support --- packages/hydrooj/src/service/storage.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/hydrooj/src/service/storage.ts b/packages/hydrooj/src/service/storage.ts index 82a687127..1680545e0 100644 --- a/packages/hydrooj/src/service/storage.ts +++ b/packages/hydrooj/src/service/storage.ts @@ -61,7 +61,6 @@ class RemoteStorageService { public client: S3Client; public error = ''; public bucket = 'hydro'; - private replaceWithAlternativeUrlFor: Record<'user' | 'judge', (originalUrl: string) => string>; private alternatives: Record<'user' | 'judge', S3Client> = { user: null, judge: null, @@ -93,10 +92,6 @@ class RemoteStorageService { endpoint: endPoint, ...base, }); - this.replaceWithAlternativeUrlFor = { - user: parseAlternativeEndpointUrl(endPointForUser), - judge: parseAlternativeEndpointUrl(endPointForJudge), - }; if (/^https?:\/\//.test(endPointForUser)) { this.alternatives.user = new S3Client({ endpoint: endPointForUser, @@ -210,7 +205,6 @@ class RemoteStorageService { }), { expiresIn: noExpire ? 24 * 60 * 60 * 7 : 10 * 60, }); - if (useAlternativeEndpointFor) return this.replaceWithAlternativeUrlFor[useAlternativeEndpointFor](url); return url; } @@ -230,10 +224,7 @@ class RemoteStorageService { }, Expires: 600, }); - return { - url: this.replaceWithAlternativeUrlFor.user(url), - fields, - }; + return { url, fields }; } async copy(src: string, target: string) {