mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
fix(plugin-fm): fix cos path error (#4537)
This commit is contained in:
parent
dc309cbab5
commit
ccef72cb0b
@ -47,7 +47,7 @@ export function FileSizeField(props) {
|
||||
const dvOption = getUnitOption(defaultValue, defaultUnit);
|
||||
const dv = defaultValue / dvOption.value;
|
||||
const vOption = getUnitOption(value ?? defaultValue, defaultUnit);
|
||||
const v = value == null ? dv : value / vOption.value;
|
||||
const v = value == null ? value : value / vOption.value;
|
||||
|
||||
const onNumberChange = useCallback(
|
||||
(val) => {
|
||||
|
@ -44,7 +44,7 @@ function getFileData(ctx: Context) {
|
||||
// make compatible filename across cloud service (with path)
|
||||
const filename = Path.basename(name);
|
||||
const extname = Path.extname(filename);
|
||||
const path = storage.path.replace(/^\/|\/$/g, '');
|
||||
const path = (storage.path || '').replace(/^\/|\/$/g, '');
|
||||
const baseUrl = storage.baseUrl.replace(/\/+$/, '');
|
||||
const pathname = [path, filename].filter(Boolean).join('/');
|
||||
|
||||
|
@ -11,15 +11,18 @@ import { promisify } from 'util';
|
||||
|
||||
import { AttachmentModel, StorageType } from '.';
|
||||
import { STORAGE_TYPE_TX_COS } from '../../constants';
|
||||
import { cloudFilenameGetter, getFileKey } from '../utils';
|
||||
import { getFilename, getFileKey } from '../utils';
|
||||
|
||||
export default class extends StorageType {
|
||||
filenameKey = 'url';
|
||||
make(storage) {
|
||||
const createTxCosStorage = require('multer-cos');
|
||||
return new createTxCosStorage({
|
||||
cos: storage.options,
|
||||
filename: cloudFilenameGetter(storage),
|
||||
cos: {
|
||||
...storage.options,
|
||||
dir: (storage.path ?? '').replace(/\/+$/, ''),
|
||||
},
|
||||
filename: getFilename,
|
||||
});
|
||||
}
|
||||
defaults() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user