File Download
This page explains the current Geelato file download and preview capability, including runtime entry points and the difference between local files and OSS files.
The description is based on:
DownloadControllerFileHandlerBaseHandlerAttachController
Download Entry
The main runtime entry is:
GET /api/resources/file
Common parameters include:
idisPdfisPreviewisThumbnail
How the Runtime Resolves the File
The runtime does not directly expose a disk path.
The flow is:
- load attachment metadata by attachment ID
- optionally switch to a thumbnail record
- decide whether the attachment is local or OSS based
- open a stream or local file
- write the response in preview or download mode
Local File Download
When:
objectIdis empty
the runtime treats the attachment as a local file and reads:
Attachment.path
as a local filesystem path.
OSS File Download
When:
objectIdis not empty
the runtime treats the attachment as an OSS object.
It then:
- uses
Attachment.pathas the object name - calls
FileHelper.getFile(...) - reads the OSS input stream
- sends it through the same unified download output
Preview and PDF Conversion
The download entry supports:
isPreviewisPdf
If isPdf=true, the runtime converts the original file to PDF first, then outputs the PDF file.
The temporary converted PDF file is stored under:
geelato.upload.convert-directory
There is also:
GET /api/attach/toPdf/{id}
which converts an Excel attachment into a new PDF attachment record.
Config File Download
The runtime also provides:
GET /api/resources/json
to read .config files from:
geelato.upload.config-directory
Related Attachment APIs
Related attachment APIs include:
GET /api/attach/get/{id}POST /api/attach/image/{id}POST /api/attach/validPOST /api/attach/storage/{type}DELETE /api/attach/remove/{id}
These support validation, storage migration, and deletion workflows around download.