mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-05-11 06:11:15 +00:00
feat: add support for 7z, PDF, STL, and other document types
- Add 7Z and DOCUMENT to ArchiveType enum - Detect .7z, .pdf, .stl, .obj, .3mf, .step, .blend, .gcode, .svg, .dxf, .ai, .eps, .psd files as fetchable documents - Handle DOCUMENT and 7Z formats in worker pipeline (skip extraction, record file as single entry) - Add Prisma migration for new enum values
This commit is contained in:
@@ -873,8 +873,21 @@ async function processOneArchiveSet(
|
||||
try {
|
||||
if (archiveSet.type === "ZIP") {
|
||||
entries = await readZipCentralDirectory(tempPaths);
|
||||
} else {
|
||||
} else if (archiveSet.type === "RAR") {
|
||||
entries = await readRarContents(tempPaths[0]);
|
||||
} else if (archiveSet.type === "DOCUMENT" || archiveSet.type === "7Z") {
|
||||
// Standalone documents (PDF, STL, etc.) and 7z files — no extraction needed,
|
||||
// just record the file itself as the single entry
|
||||
const part = archiveSet.parts[0];
|
||||
const ext = part.fileName.match(/\.([^.]+)$/)?.[1] ?? null;
|
||||
entries = [{
|
||||
path: part.fileName,
|
||||
fileName: part.fileName,
|
||||
extension: ext,
|
||||
compressedSize: part.fileSize,
|
||||
uncompressedSize: part.fileSize,
|
||||
crc32: null,
|
||||
}];
|
||||
}
|
||||
} catch (err) {
|
||||
accountLog.warn({ err, baseName: archiveSet.baseName }, "Failed to read archive metadata, ingesting without file list");
|
||||
@@ -975,7 +988,7 @@ async function processOneArchiveSet(
|
||||
contentHash,
|
||||
fileName: archiveName,
|
||||
fileSize: totalSize,
|
||||
archiveType: archiveSet.type,
|
||||
archiveType: archiveSet.type === "7Z" ? "SEVEN_Z" : archiveSet.type,
|
||||
sourceChannelId: channel.id,
|
||||
sourceMessageId: archiveSet.parts[0].id,
|
||||
sourceTopicId,
|
||||
|
||||
Reference in New Issue
Block a user