diff page-static.c @ 75:b12491ceabfd

pasterd: begin of custom theme
author David Demelier <markand@malikania.fr>
date Wed, 15 Mar 2023 20:15:00 +0100
parents 67b3d13a5035
children fe78b16c694d
line wrap: on
line diff
--- a/page-static.c	Wed Mar 15 19:34:00 2023 +0100
+++ b/page-static.c	Wed Mar 15 20:15:00 2023 +0100
@@ -2,11 +2,11 @@
  * page-static.c -- page /static
  *
  * Copyright (c) 2020-2023 David Demelier <markand@malikania.fr>
- * 
+ *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
- * 
+ *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@@ -33,7 +33,8 @@
 	struct stat st;
 	char path[PATH_MAX];
 
-	snprintf(path, sizeof (path), "%s%s", config.themedir, req->fullpath);
+	/* Skip /static part that we don't want in the theme directory. */
+	snprintf(path, sizeof (path), "%s%s", config.themedir, req->fullpath + 7);
 
 	if (stat(path, &st) < 0)
 		page_status(req, KHTTP_404);