Preview files in My files without downloading them, HEIC included #154
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 564 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.379
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #154"
general
weight: 0.35
ethanteng
What changed
Clicking a file in My files used to offer only its details and a download. Now:
How it works
Showing files.
GET /api/files/file?path=sends one of your own files inline. It uses the same allow-list (SharePreview) and locked-down security headers as shared links'/api/shared/{token}/file, so HTML, SVG and the like are still only ever downloads. The path is opened before the kind is checked, so anything a download refuses (paths outside your folder, hidden folders, links) is refused the same way./api/filesnow lists each file'spreviewkind. Both file routes go through one helper,ShowAsync.HEIC.
PhotoPreviewsconverts with macOS's built-in/usr/bin/sipsinto a JPEG of at most 2560px (never enlarged). An 8.7 MB HEIC became a 485 KB JPEG in about 0.45 s the first time and 3 ms afterwards. Details:The cache. Converted JPEGs live under the account's
.homebase/previews(never browsed, copied or synced). It's capped at 512 MB per account, roughly 1,000 photos, and the least recently viewed are deleted first. Backups exclude it and the account's own "You use…" figure leaves it out. The host-wide storage cap still counts it, since it does take up disk.Hosts that can't convert. On a Linux host, or for a file
sipscan't read, the photo is sent as it is, same as before. Safari shows it; other browsers show "can't show this file" and offer the download.Refactor. The shared-link page already had a viewer. It moves from
SharedPage.tsxintoPreview.tsx, takes its show and download addresses as arguments instead of a link token, and both pages use it. Behaviour on shared pages is unchanged.Things worth a look
nosniffand a sandboxed CSP.sipsis run with an argument list, never a shell, on a path thatPathPolicyhas already resolved inside the account. A shared-link visitor can cause the owner's HEIC to be converted, but only for a photo the link already shares.docs/ios.mdalready plans/api/files/thumbnail, which could reuse this cache.docs/ios.mddescribes.Testing
PhotoPreviewTestscovers convert-once, same-request dedupe, re-converting after an edit, shared links, both fallbacks, the cache budget and usage. The test host defaults to "can't convert" and uses a stand-in converter, so CI behaves the same on macOS and Ubuntu. The one test of realsipsruns only on macOS.🤖 Generated with Claude Code