fix(plugin-fm): fix local storage config and skip empty base url (#1294)

This commit is contained in:
Junyi 2022-12-28 23:18:14 +08:00 committed by GitHub
parent 7e64c763b2
commit 0d732d214c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -11,6 +11,7 @@ const schema = {
type: 'string', type: 'string',
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
'x-component': 'Input', 'x-component': 'Input',
required: true,
}, },
path: { path: {
title: '{{t("Path")}}', title: '{{t("Path")}}',

View File

@ -51,6 +51,7 @@ const collection = {
title: '{{t("Storage base URL")}}', title: '{{t("Storage base URL")}}',
type: 'string', type: 'string',
'x-component': 'Input', 'x-component': 'Input',
required: true,
} as ISchema, } as ISchema,
}, },
{ {

View File

@ -68,7 +68,12 @@ async function middleware(app: Application) {
app.use(async function (ctx, next) { app.use(async function (ctx, next) {
for (const storage of storages.values()) { for (const storage of storages.values()) {
const baseUrl = storage.get('baseUrl'); const baseUrl = storage.get('baseUrl').trim();
if (!baseUrl) {
console.error('"baseUrl" is not configured');
// return ctx.throw(500);
continue;
}
let url; let url;
try { try {