mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Fix redbean to only check additional content types when Lua is present (#1033)
Closes #971
This commit is contained in:
parent
ce0143e2a1
commit
6be9477b9e
1 changed files with 4 additions and 2 deletions
|
@ -4956,10 +4956,11 @@ static int LuaProgramTokenBucket(lua_State *L) {
|
|||
}
|
||||
|
||||
static const char *GetContentTypeExt(const char *path, size_t n) {
|
||||
const char *r, *e;
|
||||
const char *r = NULL, *e;
|
||||
if ((r = FindContentType(path, n))) return r;
|
||||
#ifndef STATIC
|
||||
int top;
|
||||
lua_State *L = GL;
|
||||
if ((r = FindContentType(path, n))) return r;
|
||||
|
||||
// extract the last .; use the entire path if none is present
|
||||
if ((e = memrchr(path, '.', n))) {
|
||||
|
@ -4974,6 +4975,7 @@ static const char *GetContentTypeExt(const char *path, size_t n) {
|
|||
if (lua_gettable(L, -2) == LUA_TSTRING)
|
||||
r = FreeLater(strdup(lua_tostring(L, -1)));
|
||||
lua_settop(L, top);
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue