fix: socket should not notify hidden folder or file
fix: socket should not notify hidden folder
This commit is contained in:
parent
7a0727927b
commit
7eada9e0dd
2 changed files with 41 additions and 35 deletions
|
|
@ -309,13 +309,14 @@ export class StorageController extends Controller {
|
|||
|
||||
if (!created) throw new Error(MINIO_ERROR_MESSAGE);
|
||||
|
||||
io.getInstance()?.emit("FolderCreate", {
|
||||
pathname: stripLeadingSlash(
|
||||
`${path.join("/")}/${name.replace(/[/\\?%*:|"<>#]/g, "-").trim()}/`,
|
||||
),
|
||||
name: name.replace(/[/\\?%*:|"<>#]/g, "-").trim(),
|
||||
...meta,
|
||||
});
|
||||
!name.startsWith(".") &&
|
||||
io.getInstance()?.emit("FolderCreate", {
|
||||
pathname: stripLeadingSlash(
|
||||
`${path.join("/")}/${name.replace(/[/\\?%*:|"<>#]/g, "-").trim()}/`,
|
||||
),
|
||||
name: name.replace(/[/\\?%*:|"<>#]/g, "-").trim(),
|
||||
...meta,
|
||||
});
|
||||
|
||||
return this.setStatus(HttpStatusCode.NO_CONTENT);
|
||||
}
|
||||
|
|
@ -550,7 +551,7 @@ export class StorageController extends Controller {
|
|||
refresh: "wait_for", // Must have or else it doesn't wait for updated index resulted in data not found on fetch
|
||||
});
|
||||
|
||||
io.getInstance()?.emit("FileUploadRequest", metadata);
|
||||
!metadata.hidden && io.getInstance()?.emit("FileUploadRequest", metadata);
|
||||
|
||||
const presignedUrl = await minioClient.presignedPutObject(DEFAULT_BUCKET, metadata.pathname);
|
||||
|
||||
|
|
@ -664,17 +665,19 @@ export class StorageController extends Controller {
|
|||
)
|
||||
.catch((e) => console.error(`ElasticSearch Error: ${e}`));
|
||||
|
||||
io.getInstance()?.emit("FileMove", {
|
||||
from: source,
|
||||
to: {
|
||||
...source,
|
||||
...metadata,
|
||||
path: stripLeadingSlash(`${to.path.join("/")}/`),
|
||||
pathname: dst,
|
||||
fileName: to.file,
|
||||
...dateMeta,
|
||||
},
|
||||
});
|
||||
if (!source.hidden && !metadata.hidden) {
|
||||
io.getInstance()?.emit("FileMove", {
|
||||
from: source,
|
||||
to: {
|
||||
...source,
|
||||
...metadata,
|
||||
path: stripLeadingSlash(`${to.path.join("/")}/`),
|
||||
pathname: dst,
|
||||
fileName: to.file,
|
||||
...dateMeta,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (upload) {
|
||||
const presignedUrl = await minioClient.presignedPutObject(DEFAULT_BUCKET, dst);
|
||||
|
|
@ -697,14 +700,16 @@ export class StorageController extends Controller {
|
|||
})
|
||||
.catch((e) => console.error(`ElasticSearch Error: ${e}`));
|
||||
|
||||
io.getInstance()?.emit("FileMove", {
|
||||
from: source,
|
||||
to: {
|
||||
...source,
|
||||
...metadata,
|
||||
...dateMeta,
|
||||
},
|
||||
});
|
||||
if (!source.hidden && !metadata.hidden) {
|
||||
io.getInstance()?.emit("FileMove", {
|
||||
from: source,
|
||||
to: {
|
||||
...source,
|
||||
...metadata,
|
||||
...dateMeta,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (upload) {
|
||||
const src = stripLeadingSlash(`${from.path.join("/")}/${from.file}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue