mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix(plugin-file-manager): increase url length (#6275)
* fix(plugin-file-manager): increase url length * fix(client): fix null value
This commit is contained in:
parent
7857993dcd
commit
cdcea99e30
@ -389,7 +389,7 @@ export function Uploader({ rules, ...props }: UploadProps) {
|
||||
if (pendingFiles.length) {
|
||||
setUploadedList(valueList);
|
||||
} else {
|
||||
onChange?.([...value, ...valueList]);
|
||||
onChange?.([...(value || []), ...valueList]);
|
||||
setUploadedList([]);
|
||||
}
|
||||
}
|
||||
|
@ -104,6 +104,7 @@ export class FileCollectionTemplate extends CollectionTemplate {
|
||||
type: 'string',
|
||||
name: 'url',
|
||||
deletable: false,
|
||||
length: 1024,
|
||||
uiSchema: {
|
||||
type: 'string',
|
||||
title: `{{t("URL")}}`,
|
||||
|
@ -70,6 +70,7 @@ export default defineCollection({
|
||||
comment: '网络访问地址',
|
||||
type: 'string',
|
||||
name: 'url',
|
||||
length: 1024,
|
||||
// formula: '{{ storage.baseUrl }}{{ path }}/{{ filename }}'
|
||||
},
|
||||
],
|
||||
|
@ -0,0 +1,55 @@
|
||||
/**
|
||||
* This file is part of the NocoBase (R) project.
|
||||
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
||||
* Authors: NocoBase Team.
|
||||
*
|
||||
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { DataTypes } from 'sequelize';
|
||||
import { Migration } from '@nocobase/server';
|
||||
|
||||
export default class extends Migration {
|
||||
on = 'afterLoad'; // 'beforeLoad' or 'afterLoad'
|
||||
appVersion = '<1.5.14';
|
||||
|
||||
async up() {
|
||||
const queryInterface = this.db.sequelize.getQueryInterface();
|
||||
const CollectionRepo = this.db.getRepository('collections');
|
||||
const FieldRepo = this.db.getRepository('fields');
|
||||
await this.db.sequelize.transaction(async (transaction) => {
|
||||
const collections = await CollectionRepo.find({
|
||||
filter: {
|
||||
'options.template': 'file',
|
||||
},
|
||||
transaction,
|
||||
});
|
||||
collections.push({
|
||||
name: 'attachments',
|
||||
});
|
||||
for (const item of collections) {
|
||||
const collection = this.db.getCollection(item.name) || this.db.collection(item);
|
||||
const tableName = collection.getTableNameWithSchema();
|
||||
await queryInterface.changeColumn(
|
||||
tableName,
|
||||
'url',
|
||||
{
|
||||
type: DataTypes.STRING(1024),
|
||||
},
|
||||
{ transaction },
|
||||
);
|
||||
await FieldRepo.update({
|
||||
filter: {
|
||||
collectionName: item.name,
|
||||
name: 'url',
|
||||
},
|
||||
values: {
|
||||
length: 1024,
|
||||
},
|
||||
transaction,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user