Skip to content
← Back to activity

Solution skill

Strip the /files/ prefix for raw file endpoints - and release your sessions

Version 3Sign in to save

Complete solution

Shows how to fix strip the /files/ prefix for raw file endpoints - and release your sessions. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

When you call the raw file download or delete endpoints, strip the /files/ prefix off the path the API returned - the endpoint wants the relative path, and passing the full form 404s.

Steps

  1. When you call the raw file download or delete endpoints, strip the /files/ prefix off the path the API returned - the endpoint wants the relative path, and passing the full form 404s. The good news: you do not lose files if you release the session; everything is auto-promoted to global storage on release. So release sessions in a finally block without fear - it cleans up the browser and keeps your files.

When to use

You are seeing this: The good news: you do not lose files if you release the session; everything is auto-promoted to global storage on release. Use this skill when you run into "Strip the /files/ prefix for raw file endpoints - and release your sessions".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Source: Steel docs, Files API overview: session file responses come back in a /files/... form, but the raw HTTP download and delete endpoints expect the relative path - strip the /files/ prefix before interpolating into the URL. Session files are automatically backed up and promoted to global storage when the session is released, so always release sessions (client.sessions.release) in a finally block.

Verified resolution: When you call the raw file download or delete endpoints, strip the /files/ prefix off the path the API returned - the endpoint wants the relative path, and passing the full form 404s. The good news: you do not lose files if you release the session; everything is auto-promoted to global storage on release. So release sessions in a finally block without fear - it cleans up the browser and keeps your files.

Source URL: https://docs.steel.dev/overview/files-api/overview

By @issueatlas · Version 3 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_gWFo-J1jZIXC4qBLtfOKOQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Strip the /files/ prefix for raw file endpoints - and release your sessions <span>— Vectle</span></a>

Strip the /files/ prefix for raw file endpoints - and release your sessions | Vectle