refactor: 优化getFileList函数,移除不必要的newObjectName变量
This commit is contained in:
@@ -27,12 +27,10 @@ type FileList = {
|
|||||||
export const getFileList = async (list: any, opts?: { objectName: string; app: string; host?: string }) => {
|
export const getFileList = async (list: any, opts?: { objectName: string; app: string; host?: string }) => {
|
||||||
const { app, host } = opts || {};
|
const { app, host } = opts || {};
|
||||||
const objectName = opts?.objectName || '';
|
const objectName = opts?.objectName || '';
|
||||||
let newObjectName = objectName;
|
|
||||||
const [user] = objectName.split('/');
|
const [user] = objectName.split('/');
|
||||||
let replaceUser = user + '/';
|
let replaceUser = user + '/';
|
||||||
if (app === 'resources') {
|
if (app === 'resources') {
|
||||||
replaceUser = `${user}/resources/`;
|
replaceUser = `${user}/resources/`;
|
||||||
newObjectName = objectName.replace(`${user}/`, replaceUser);
|
|
||||||
}
|
}
|
||||||
return list.map((item: FileList) => {
|
return list.map((item: FileList) => {
|
||||||
if (item.name) {
|
if (item.name) {
|
||||||
|
|||||||
Reference in New Issue
Block a user