security: remediate vulnerabilities and issues from codebase audit
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m15s

This commit is contained in:
Elijah 2026-05-23 10:04:08 -07:00
parent b60a09196a
commit fb3f3a3393
15 changed files with 465 additions and 208 deletions

View file

@ -18,6 +18,7 @@ interface FilePreviewProps {
mime_type: string;
} | null;
onClose: () => void;
downloadToken?: string;
}
function getFileDisplayName(name: string) {
@ -26,7 +27,7 @@ function getFileDisplayName(name: string) {
return name;
}
export default function FilePreview({ file, onClose }: FilePreviewProps) {
export default function FilePreview({ file, onClose, downloadToken }: FilePreviewProps) {
const [content, setContent] = useState<string | null>(null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
@ -53,7 +54,8 @@ export default function FilePreview({ file, onClose }: FilePreviewProps) {
setLoading(true);
setError(null);
fetch(api.getDownloadUrl(file.path))
if (!downloadToken) return;
fetch(api.getDownloadUrl(file.path, downloadToken))
.then((res) => {
if (!res.ok) throw new Error('Failed to load file content');
return res.text();
@ -67,7 +69,7 @@ export default function FilePreview({ file, onClose }: FilePreviewProps) {
if (!file) return null;
const previewType = getPreviewType(file);
const downloadUrl = api.getDownloadUrl(file.path);
const downloadUrl = downloadToken ? api.getDownloadUrl(file.path, downloadToken) : '';
return (
<AnimatePresence>