@axiom-lattice/gateway 3.0.9 → 3.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -4896,11 +4896,10 @@ var WorkspaceController = class {
|
|
|
4896
4896
|
projectId
|
|
4897
4897
|
};
|
|
4898
4898
|
const filename2 = getFilenameFromPath(resolvedPath);
|
|
4899
|
-
const isBinary = this.isBinaryContentType(filename2);
|
|
4900
4899
|
const volumeBackend = await sandboxManager.getVolumeBackendForPath(volumeConfig, resolvedPath);
|
|
4901
4900
|
let buf;
|
|
4902
4901
|
if (volumeBackend) {
|
|
4903
|
-
if (
|
|
4902
|
+
if (volumeBackend.readBinary) {
|
|
4904
4903
|
buf = await volumeBackend.readBinary(resolvedPath);
|
|
4905
4904
|
} else {
|
|
4906
4905
|
const fileData = await volumeBackend.readRaw(resolvedPath);
|
|
@@ -4915,10 +4914,12 @@ var WorkspaceController = class {
|
|
|
4915
4914
|
return reply.status(200).type(inferredContentType).header("Content-Disposition", contentDisposition).send(buf);
|
|
4916
4915
|
}
|
|
4917
4916
|
const { backend } = await this.getBackend(tenantId, workspaceId, projectId, assistantId, resolvedPath);
|
|
4918
|
-
|
|
4917
|
+
if (!backend.readBinary) {
|
|
4918
|
+
throw new Error("Filesystem backend does not support binary reads");
|
|
4919
|
+
}
|
|
4920
|
+
const buffer = await backend.readBinary(resolvedPath);
|
|
4919
4921
|
const filename = getFilenameFromPath(resolvedPath);
|
|
4920
4922
|
const mimeType = getContentTypeFromFilename(filename);
|
|
4921
|
-
const buffer = Buffer.from(content, "utf-8");
|
|
4922
4923
|
return reply.status(200).type(mimeType).header("Content-Disposition", `attachment; filename*=UTF-8''${encodeURIComponent(filename)}`).send(buffer);
|
|
4923
4924
|
} catch (error) {
|
|
4924
4925
|
const message = error instanceof Error ? error.message : String(error);
|