fix: wrong path

This commit is contained in:
Methapon2001 2023-11-29 17:43:55 +07:00
parent a3c5188103
commit 0691f29409
No known key found for this signature in database
GPG key ID: 849924FEF46BD132
4 changed files with 13 additions and 13 deletions

View file

@ -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",
});

View file

@ -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",
});

View file

@ -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",
});

View file

@ -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",
});