Merge branch 'main' into development

# Conflicts:
#	.github/workflows/release.yaml
This commit is contained in:
DESKTOP-2S5P7D1\Windows 10 2024-12-19 11:19:23 +07:00
commit e9287e8dd7
2 changed files with 43 additions and 10 deletions

View file

@ -44,7 +44,10 @@ export async function handler(key: string, event: string): Promise<boolean> {
try {
const stat = await minioClient.statObject(bucket, pathname);
cachedMetadata[key] = { size: stat.size, type: stat.metaData["content-type"] };
if (stat.size > 1024 * 1024 * 100) cachedBuffer[key] = Buffer.from([]);
if (stat.size > 1024 * 1024 * 100) {
console.warn("[AMQ] File is too large. Data extract will be skipped.");
cachedBuffer[key] = Buffer.from([]);
}
} catch (e: any) {
if (e.code === "NoSuchKey") {
console.info(`[AMQ] Key: ${key} received but cannot be found.`);
@ -151,7 +154,7 @@ async function handleNotFoundRecord(
if (!errorKey.includes(key)) {
try {
Buffer.from(buffer).toString("base64");
base64 = Buffer.from(buffer).toString("base64");
} catch (e) {
console.warn("[WARN] Cannot extract data from the file.", e);
}
@ -214,7 +217,7 @@ async function handleFoundRecord(
if (!errorKey.includes(key)) {
try {
Buffer.from(buffer).toString("base64");
base64 = Buffer.from(buffer).toString("base64");
} catch (e) {
console.warn("[WARN] Cannot extract data from the file.", e);
}