Add Public decorator to file streaming endpoint for direct browser access

This commit is contained in:
Marshal
2026-06-28 08:01:00 +00:00
parent 7a2a55d94b
commit b424de8436

View File

@@ -7,6 +7,7 @@ import {
Res,
} from "@nestjs/common";
import { ApiOperation, ApiQuery, ApiTags } from "@nestjs/swagger";
import { Public } from "@edr/api-common";
import { Response } from "express";
import { FilesService } from "./files.service";
@@ -17,6 +18,10 @@ export class FilesController {
constructor(private readonly filesService: FilesService) {}
@Get(":fileId")
// Public so the browser can load the bytes directly via <img>/<iframe>/<a> —
// those requests can't carry the Bearer token the axios client injects, so a
// guarded route 401s. File UUIDs are unguessable; same tradeoff as webhooks.
@Public()
@ApiOperation({
summary: "Stream a file by ID",
description: