mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 11:12:20 +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 dvOption = getUnitOption(defaultValue, defaultUnit);
|
||||||
const dv = defaultValue / dvOption.value;
|
const dv = defaultValue / dvOption.value;
|
||||||
const vOption = getUnitOption(value ?? defaultValue, defaultUnit);
|
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(
|
const onNumberChange = useCallback(
|
||||||
(val) => {
|
(val) => {
|
||||||
|
@ -44,7 +44,7 @@ function getFileData(ctx: Context) {
|
|||||||
// make compatible filename across cloud service (with path)
|
// make compatible filename across cloud service (with path)
|
||||||
const filename = Path.basename(name);
|
const filename = Path.basename(name);
|
||||||
const extname = Path.extname(filename);
|
const extname = Path.extname(filename);
|
||||||
const path = storage.path.replace(/^\/|\/$/g, '');
|
const path = (storage.path || '').replace(/^\/|\/$/g, '');
|
||||||
const baseUrl = storage.baseUrl.replace(/\/+$/, '');
|
const baseUrl = storage.baseUrl.replace(/\/+$/, '');
|
||||||
const pathname = [path, filename].filter(Boolean).join('/');
|
const pathname = [path, filename].filter(Boolean).join('/');
|
||||||
|
|
||||||
|
@ -11,15 +11,18 @@ import { promisify } from 'util';
|
|||||||
|
|
||||||
import { AttachmentModel, StorageType } from '.';
|
import { AttachmentModel, StorageType } from '.';
|
||||||
import { STORAGE_TYPE_TX_COS } from '../../constants';
|
import { STORAGE_TYPE_TX_COS } from '../../constants';
|
||||||
import { cloudFilenameGetter, getFileKey } from '../utils';
|
import { getFilename, getFileKey } from '../utils';
|
||||||
|
|
||||||
export default class extends StorageType {
|
export default class extends StorageType {
|
||||||
filenameKey = 'url';
|
filenameKey = 'url';
|
||||||
make(storage) {
|
make(storage) {
|
||||||
const createTxCosStorage = require('multer-cos');
|
const createTxCosStorage = require('multer-cos');
|
||||||
return new createTxCosStorage({
|
return new createTxCosStorage({
|
||||||
cos: storage.options,
|
cos: {
|
||||||
filename: cloudFilenameGetter(storage),
|
...storage.options,
|
||||||
|
dir: (storage.path ?? '').replace(/\/+$/, ''),
|
||||||
|
},
|
||||||
|
filename: getFilename,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
defaults() {
|
defaults() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user