Where Will the Uploaded Files End Up?
Follow archive entries into filesystem writes and uploaded bytes into browser responses, starting with an ordinary contained file.
You’re reading a preview. Premium includes the full lesson and specialist practice. View the full curriculum.
A clean filename can hide several other decisions
A workspace accepts a logo image and a backup archive. The server removes directory components from the outer filename. That is useful, but it does not tell us what the logo's bytes contain or where the archive's internal entries will be written.
We'll follow two separate journeys: extracting a backup and serving an uploaded file to a browser.
Open the archive's inner map
A backup can contain names like these:
backup.zip
notes/welcome.txt → an intended file inside the workspace
../../config/runtime.txt → a proposed destination outside it
The outer name backup.zip is not used to choose every inner file's destination. Each entry needs its own checks.
A link creates another problem. An entry can create drafts as a link to an outside directory; a later entry named drafts/item.txt may follow it. Looking at the name's spelling alone does not establish where the write goes.