Skip to content

Commit 6be9477

Browse files
authored
Fix redbean to only check additional content types when Lua is present (#1033)
Closes #971
1 parent ce0143e commit 6be9477

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tool/net/redbean.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4956,10 +4956,11 @@ static int LuaProgramTokenBucket(lua_State *L) {
49564956
}
49574957

49584958
static const char *GetContentTypeExt(const char *path, size_t n) {
4959-
const char *r, *e;
4959+
const char *r = NULL, *e;
4960+
if ((r = FindContentType(path, n))) return r;
4961+
#ifndef STATIC
49604962
int top;
49614963
lua_State *L = GL;
4962-
if ((r = FindContentType(path, n))) return r;
49634964

49644965
// extract the last .; use the entire path if none is present
49654966
if ((e = memrchr(path, '.', n))) {
@@ -4974,6 +4975,7 @@ static const char *GetContentTypeExt(const char *path, size_t n) {
49744975
if (lua_gettable(L, -2) == LUA_TSTRING)
49754976
r = FreeLater(strdup(lua_tostring(L, -1)));
49764977
lua_settop(L, top);
4978+
#endif
49774979
return r;
49784980
}
49794981

0 commit comments

Comments
 (0)