fix(frontend): correct path length check for workspace download requests

The isWorkspaceDownloadRequest function was checking for path.length >= 4,
but the pattern api/workspace/files/{id}/download has 5 segments. This
allowed malformed requests missing the file_id to be incorrectly routed
through the binary download handler.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Nicholas Tindle
2026-01-28 01:00:07 -06:00
parent 87814bcdcb
commit 5bbc3d55f0

View File

@@ -20,9 +20,9 @@ function buildBackendUrl(path: string[], queryString: string): string {
* Check if this is a workspace file download request that needs binary response handling.
*/
function isWorkspaceDownloadRequest(path: string[]): boolean {
// Match pattern: api/workspace/files/{id}/download
// Match pattern: api/workspace/files/{id}/download (5 segments)
return (
path.length >= 4 &&
path.length >= 5 &&
path[0] === "api" &&
path[1] === "workspace" &&
path[2] === "files" &&