]> Untitled Git - lemmy-ui.git/commitdiff
Merge branch 'main' into bug/cant-set-headers-after-sent-fix
authorJay Sitter <jsit@users.noreply.github.com>
Sun, 25 Jun 2023 16:41:28 +0000 (12:41 -0400)
committerGitHub <noreply@github.com>
Sun, 25 Jun 2023 16:41:28 +0000 (12:41 -0400)
src/server/handlers/theme-handler.ts

index b107d8542461732a5bf6b78ae6e57b11d0733ad3..456fb3bd00e0d646d03edb6634f4d50d4d03ea94 100644 (file)
@@ -11,22 +11,21 @@ export default async (req: Request, res: Response) => {
   const theme = req.params.name;
 
   if (!theme.endsWith(".css")) {
-    res.statusCode = 400;
-    res.send("Theme must be a css file");
+    return res.status(400).send("Theme must be a css file");
   }
 
   const customTheme = path.resolve(extraThemesFolder, theme);
 
   if (existsSync(customTheme)) {
-    res.sendFile(customTheme);
+    return res.sendFile(customTheme);
   } else {
     const internalTheme = path.resolve(`./dist/assets/css/themes/${theme}`);
 
     // If the theme doesn't exist, just send litely
     if (existsSync(internalTheme)) {
-      res.sendFile(internalTheme);
+      return res.sendFile(internalTheme);
     } else {
-      res.sendFile(path.resolve("./dist/assets/css/themes/litely.css"));
+      return res.sendFile(path.resolve("./dist/assets/css/themes/litely.css"));
     }
   }
 };