1
0
Fork 0

add nullability hehe

Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
Sam Therapy 2022-09-29 12:18:32 +02:00
parent 87f45866d7
commit 7d41a2b8db
Signed by: sam
GPG Key ID: 4D8B07C18F31ACBD
6 changed files with 279 additions and 271 deletions

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

View File

@ -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

View File

@ -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"
}

View File

@ -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":

View File

@ -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)

View File

@ -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