document to markdown

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-07-18 11:40:47 +08:00
parent 941590f51a
commit b241220c15
8 changed files with 343 additions and 11 deletions
+13
View File
@@ -35,6 +35,17 @@ const credentials = {
secretAccessKey: process.env.S3_SECRET_KEY,
};
// responseChecksumValidation: "WHEN_REQUIRED" — the AWS SDK v3 defaults to
// "WHEN_SUPPORTED", which validates any response carrying an x-amz-checksum-*
// header. Garage sends x-amz-checksum-crc32 on GetObject but its value doesn't
// match what the SDK recomputes over the body, so every direct GetObjectCommand
// (e.g. getObjectStream() below, used by the document-to-Markdown converter)
// threw "Checksum mismatch" even though the bytes themselves were fine.
// WHEN_REQUIRED skips validation unless the operation mandates it (GetObject
// never does) — safe here since Garage isn't computing/verifying per AWS spec
// anyway.
const CHECKSUM_CONFIG = { responseChecksumValidation: "WHEN_REQUIRED" };
// Internal client — uploads, deletes, direct streams from the server itself.
// Always targets S3_ENDPOINT. When this backend is co-located with Garage,
// that's a local address; when it isn't, S3_ENDPOINT must instead be a
@@ -45,6 +56,7 @@ const s3 = new S3Client({
region: process.env.S3_REGION || "garage",
credentials,
forcePathStyle: true,
...CHECKSUM_CONFIG,
});
const DEFAULT_BUCKET = process.env.S3_BUCKET;
@@ -76,6 +88,7 @@ function getPublicClient() {
region: process.env.S3_REGION || "garage",
credentials,
forcePathStyle: true,
...CHECKSUM_CONFIG,
});
}