Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

337 B
Raw Blame
import { readFile } from 'node:fs/promises';
import path from 'node:path';

export const readAttachment = async (input: { path: string }) => {
  const root = '/srv/attachments';
  const target = path.resolve(root, input.path);
  if (!target.startsWith(root)) throw new Error('Forbidden');
  // alint-expect
  return readFile(target);
};