mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: get mime from library that checks the file binary
This commit is contained in:
parent
17cfc7bb02
commit
887d97fd20
3 changed files with 13 additions and 9 deletions
|
@ -3,7 +3,7 @@ import { HydraApi } from "@main/services/hydra-api";
|
|||
import axios from "axios";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import mime from "mime";
|
||||
import { fileTypeFromFile } from "file-type";
|
||||
import { UserProfile } from "@types";
|
||||
|
||||
const patchUserProfile = async (
|
||||
|
@ -44,11 +44,11 @@ const updateProfile = async (
|
|||
.then(async (preSignedResponse) => {
|
||||
const { presignedUrl, profileImageUrl } = preSignedResponse.data;
|
||||
|
||||
const mimeType = mime.getType(newProfileImagePath);
|
||||
const mimeType = await fileTypeFromFile(newProfileImagePath);
|
||||
|
||||
await axios.put(presignedUrl, fileBuffer, {
|
||||
headers: {
|
||||
"Content-Type": mimeType,
|
||||
"Content-Type": mimeType?.mime,
|
||||
},
|
||||
});
|
||||
return profileImageUrl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue