Use backend endpoint for attachment downloads
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import { ArrowDownToLine, Play } from "lucide-react";
|
||||
import { useRef, useState } from "react";
|
||||
import { postNoBody } from "../../../api";
|
||||
import { useI18n } from "../../../i18n";
|
||||
import type { Post } from "../../../types/post";
|
||||
import { useVideoPlayer } from "../overlays/VideoPlayer";
|
||||
import { autolink } from "../utils/autolink";
|
||||
import { downloadFile } from "../utils/downloadFile";
|
||||
import { downloadAttachment } from "../utils/downloadFile";
|
||||
import { formatBytes } from "../utils/formatBytes";
|
||||
import { postDisplayText } from "../utils/postText";
|
||||
|
||||
@@ -74,10 +73,9 @@ export function VideoBubble({ post }: { post: Post }) {
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
void postNoBody(
|
||||
`/api/posts/${post.id}/attachments/${att.id}/download`,
|
||||
void downloadAttachment(post.id, att.id, att.filename).catch(
|
||||
() => {},
|
||||
);
|
||||
void downloadFile(att.url, att.filename).catch(() => {});
|
||||
}}
|
||||
className="group absolute left-3 top-3 z-10 inline-flex overflow-hidden rounded-full bg-black/45 text-xs text-white shadow-lg ring-1 ring-white/15 backdrop-blur-md transition hover:bg-black/60"
|
||||
aria-label={`Download ${att.filename}`}
|
||||
|
||||
Reference in New Issue
Block a user