fix: download url
This commit is contained in:
@@ -9,7 +9,7 @@ export interface MessagePayload {
|
||||
created_at?: number;
|
||||
sending?: boolean;
|
||||
content_type: ContentType;
|
||||
content: string;
|
||||
content: string | { path: string };
|
||||
expires_in?: number | null;
|
||||
properties?: {
|
||||
name?: string;
|
||||
|
||||
@@ -14,7 +14,7 @@ interface Props {
|
||||
|
||||
interface SendMessagesDTO {
|
||||
type: "text";
|
||||
content: string;
|
||||
content: string | { path: string };
|
||||
users: number[];
|
||||
channels: number[];
|
||||
}
|
||||
|
||||
@@ -204,17 +204,18 @@ export const normalizeFileMessage = (data: MessagePayload) => {
|
||||
let res: null | { file_path?: string, content?: string, download?: string, thumbnail: string } = null;
|
||||
if (isFile) {
|
||||
if (!sending) {
|
||||
const file_path = typeof content == "string" ? content : content.path;
|
||||
res = {
|
||||
file_path: content,
|
||||
file_path,
|
||||
content: `${BASE_URL}/resource/file?file_path=${encodeURIComponent(
|
||||
content
|
||||
file_path
|
||||
)}`,
|
||||
download: `${BASE_URL}/resource/file?file_path=${encodeURIComponent(
|
||||
content
|
||||
file_path
|
||||
)}&download=true`,
|
||||
thumbnail: (isPic && !isGif)
|
||||
? `${BASE_URL}/resource/file?file_path=${encodeURIComponent(
|
||||
content
|
||||
file_path
|
||||
)}&thumbnail=true`
|
||||
: ""
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user