add nullability hehe
Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
parent
87f45866d7
commit
7d41a2b8db
532
.yarn/releases/yarn-3.2.2.cjs → .yarn/releases/yarn-3.2.3.cjs
vendored
Normal file → Executable file
532
.yarn/releases/yarn-3.2.2.cjs → .yarn/releases/yarn-3.2.3.cjs
vendored
Normal file → Executable file
File diff suppressed because one or more lines are too long
|
@ -4,4 +4,4 @@ plugins:
|
|||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||
spec: "@yarnpkg/plugin-interactive-tools"
|
||||
|
||||
yarnPath: .yarn/releases/yarn-3.2.2.cjs
|
||||
yarnPath: .yarn/releases/yarn-3.2.3.cjs
|
||||
|
|
|
@ -25,5 +25,10 @@
|
|||
"@types/express": "4.17.13",
|
||||
"@types/morgan": "1.9.3",
|
||||
"typescript": "4.7.4"
|
||||
}
|
||||
},
|
||||
"volta": {
|
||||
"node": "18.9.1",
|
||||
"yarn": "1.22.19"
|
||||
},
|
||||
"packageManager": "yarn@3.2.3"
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
export default function ContentType(extension: string): string {
|
||||
switch (
|
||||
extension.toLowerCase()?.replace("jpg", "jpeg").replace("svg", "svg+xml")
|
||||
extension?.toLowerCase()?.replace("jpg", "jpeg")?.replace("svg", "svg+xml")
|
||||
) {
|
||||
case "aces":
|
||||
case "avci":
|
||||
|
|
|
@ -13,7 +13,10 @@ export default function Search(_req: Request, res: Response) {
|
|||
.then(async (post) => {
|
||||
const imageURL = post[0]?.fileUrl as string;
|
||||
|
||||
const type = imageURL.split(".").pop() as string;
|
||||
const type = imageURL?.split(".")?.pop() as string;
|
||||
if (type == null) {
|
||||
throw "No results found";
|
||||
}
|
||||
res.setHeader("content-type", ContentType(type));
|
||||
|
||||
const img = await fetch(imageURL)
|
||||
|
|
|
@ -636,7 +636,7 @@ __metadata:
|
|||
|
||||
"typescript@patch:typescript@4.7.4#~builtin<compat/typescript>":
|
||||
version: 4.7.4
|
||||
resolution: "typescript@patch:typescript@npm%3A4.7.4#~builtin<compat/typescript>::version=4.7.4&hash=f456af"
|
||||
resolution: "typescript@patch:typescript@npm%3A4.7.4#~builtin<compat/typescript>::version=4.7.4&hash=a1c5e5"
|
||||
bin:
|
||||
tsc: bin/tsc
|
||||
tsserver: bin/tsserver
|
||||
|
|
Loading…
Reference in New Issue