mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
refactor(database): 🔥 Simplify media management code
This commit is contained in:
parent
cf1104d762
commit
bc961b70bb
7 changed files with 173 additions and 109 deletions
|
|
@ -57,8 +57,11 @@ export const urlToContentFormat = (
|
|||
};
|
||||
};
|
||||
|
||||
export const mimeLookup = (url: string): Promise<string> => {
|
||||
const naiveLookup = lookup(url.replace(new URL(url).search, ""));
|
||||
export const mimeLookup = (url: URL): Promise<string> => {
|
||||
const urlWithoutSearch = url.toString().replace(url.search, "");
|
||||
|
||||
// Strip query params from URL to get the proper file extension
|
||||
const naiveLookup = lookup(urlWithoutSearch);
|
||||
|
||||
if (naiveLookup) {
|
||||
return Promise.resolve(naiveLookup);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue