fix: wrong path
This commit is contained in:
parent
a3c5188103
commit
0691f29409
4 changed files with 13 additions and 13 deletions
|
|
@ -114,7 +114,8 @@ export class CabinetController extends Controller {
|
|||
list.map(async (current) => {
|
||||
if (!current.name) return;
|
||||
|
||||
const destination = `${replaceIllegalChars(body.name)}/${current.name.slice(path.length)}`;
|
||||
const base = `${replaceIllegalChars(body.name)}/`;
|
||||
const destination = `${base}${current.name.slice(path.length)}`;
|
||||
const source = `/${DEFAULT_BUCKET}/${current.name}`;
|
||||
|
||||
return await minioClient
|
||||
|
|
@ -138,7 +139,7 @@ export class CabinetController extends Controller {
|
|||
await esClient.update({
|
||||
index: DEFAULT_INDEX!,
|
||||
id: data._id,
|
||||
doc: { pathname: destination, path },
|
||||
doc: { pathname: destination, path: destination.split("/").splice(0, -1).join("/") },
|
||||
refresh: "wait_for",
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -131,9 +131,8 @@ export class DrawerController extends Controller {
|
|||
list.map(async (current) => {
|
||||
if (!current.name) return;
|
||||
|
||||
const destination = `${cabinetName}/${replaceIllegalChars(body.name)}/${current.name.slice(
|
||||
path.length,
|
||||
)}`;
|
||||
const base = `${cabinetName}/${replaceIllegalChars(body.name)}/`;
|
||||
const destination = `${base}${current.name.slice(path.length)}`;
|
||||
const source = `/${DEFAULT_BUCKET}/${current.name}`;
|
||||
|
||||
return await minioClient
|
||||
|
|
@ -157,7 +156,7 @@ export class DrawerController extends Controller {
|
|||
await esClient.update({
|
||||
index: DEFAULT_INDEX!,
|
||||
id: data._id,
|
||||
doc: { pathname: destination, path },
|
||||
doc: { pathname: destination, path: destination.split("/").splice(0, -1).join("/") },
|
||||
refresh: "wait_for",
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -138,9 +138,8 @@ export class FolderController extends Controller {
|
|||
list.map(async (current) => {
|
||||
if (!current.name) return;
|
||||
|
||||
const destination = `${cabinetName}/${drawerName}/${replaceIllegalChars(
|
||||
body.name,
|
||||
)}/${current.name.slice(path.length)}`;
|
||||
const base = `${cabinetName}/${drawerName}/${replaceIllegalChars(body.name)}/`;
|
||||
const destination = `${base}${current.name.slice(path.length)}`;
|
||||
const source = `/${DEFAULT_BUCKET}/${current.name}`;
|
||||
|
||||
return await minioClient
|
||||
|
|
@ -164,7 +163,7 @@ export class FolderController extends Controller {
|
|||
await esClient.update({
|
||||
index: DEFAULT_INDEX!,
|
||||
id: data._id,
|
||||
doc: { pathname: destination, path },
|
||||
doc: { pathname: destination, path: destination.split("/").splice(0, -1).join("/") },
|
||||
refresh: "wait_for",
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -139,9 +139,10 @@ export class SubFolderController extends Controller {
|
|||
list.map(async (current) => {
|
||||
if (!current.name) return;
|
||||
|
||||
const destination = `${cabinetName}/${drawerName}/${folderName}/${replaceIllegalChars(
|
||||
const base = `${cabinetName}/${drawerName}/${folderName}/${replaceIllegalChars(
|
||||
body.name,
|
||||
)}/${current.name.slice(path.length)}`;
|
||||
)}/`;
|
||||
const destination = `${base}${current.name.slice(path.length)}`;
|
||||
const source = `/${DEFAULT_BUCKET}/${current.name}`;
|
||||
|
||||
return await minioClient
|
||||
|
|
@ -165,7 +166,7 @@ export class SubFolderController extends Controller {
|
|||
await esClient.update({
|
||||
index: DEFAULT_INDEX!,
|
||||
id: data._id,
|
||||
doc: { pathname: destination, path },
|
||||
doc: { pathname: destination, path: destination.split("/").splice(0, -1).join("/") },
|
||||
refresh: "wait_for",
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue