Use backend endpoint for attachment downloads
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { ArrowDownToLine } from "lucide-react";
|
||||
import { postNoBody } from "../../../api";
|
||||
import { useI18n } from "../../../i18n";
|
||||
import type { Attachment, Post } from "../../../types/post";
|
||||
import { downloadFile } from "../utils/downloadFile";
|
||||
import { downloadAttachment } from "../utils/downloadFile";
|
||||
import { fileIcon } from "../utils/fileIcon";
|
||||
import {
|
||||
filenameWithExtension,
|
||||
@@ -17,8 +16,7 @@ function AttachmentRow({ postId, att }: { postId: string; att: Attachment }) {
|
||||
const displayFilename = filenameWithExtension(att.filename, att.mime);
|
||||
|
||||
const handleDownload = () => {
|
||||
void postNoBody(`/api/posts/${postId}/attachments/${att.id}/download`);
|
||||
void downloadFile(att.url, displayFilename).catch(() => {});
|
||||
void downloadAttachment(postId, att.id, displayFilename).catch(() => {});
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user