@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 CHANGED
@@ -6912,11 +6912,10 @@ var WorkspaceController = class {
6912
6912
  projectId
6913
6913
  };
6914
6914
  const filename2 = getFilenameFromPath(resolvedPath);
6915
- const isBinary = this.isBinaryContentType(filename2);
6916
6915
  const volumeBackend = await sandboxManager.getVolumeBackendForPath(volumeConfig, resolvedPath);
6917
6916
  let buf;
6918
6917
  if (volumeBackend) {
6919
- if (isBinary && volumeBackend.readBinary) {
6918
+ if (volumeBackend.readBinary) {
6920
6919
  buf = await volumeBackend.readBinary(resolvedPath);
6921
6920
  } else {
6922
6921
  const fileData = await volumeBackend.readRaw(resolvedPath);
@@ -6931,10 +6930,12 @@ var WorkspaceController = class {
6931
6930
  return reply.status(200).type(inferredContentType).header("Content-Disposition", contentDisposition).send(buf);
6932
6931
  }
6933
6932
  const { backend } = await this.getBackend(tenantId, workspaceId, projectId, assistantId, resolvedPath);
6934
- const content = await backend.read(resolvedPath, 0, Infinity);
6933
+ if (!backend.readBinary) {
6934
+ throw new Error("Filesystem backend does not support binary reads");
6935
+ }
6936
+ const buffer = await backend.readBinary(resolvedPath);
6935
6937
  const filename = getFilenameFromPath(resolvedPath);
6936
6938
  const mimeType = getContentTypeFromFilename(filename);
6937
- const buffer = Buffer.from(content, "utf-8");
6938
6939
  return reply.status(200).type(mimeType).header("Content-Disposition", `attachment; filename*=UTF-8''${encodeURIComponent(filename)}`).send(buffer);
6939
6940
  } catch (error) {
6940
6941
  const message = error instanceof Error ? error.message : String(error);