mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
parent
a201e694ee
commit
e8ecf31ad5
1 changed files with 5 additions and 2 deletions
|
@ -4957,12 +4957,15 @@ static const char *GetContentTypeExt(const char *path, size_t n) {
|
|||
if ((r = FindContentType(path, n))) return r;
|
||||
|
||||
// extract the last .; use the entire path if none is present
|
||||
if ((e = strrchr(path, '.'))) path = e + 1;
|
||||
if ((e = memrchr(path, '.', n))) {
|
||||
n -= e - path + 1;
|
||||
path = e + 1;
|
||||
}
|
||||
top = lua_gettop(L);
|
||||
lua_pushlightuserdata(L, (void *)&ctIdx); // push address as unique key
|
||||
CHECK_EQ(lua_gettable(L, LUA_REGISTRYINDEX), LUA_TTABLE);
|
||||
|
||||
lua_pushstring(L, path);
|
||||
lua_pushlstring(L, path, n);
|
||||
if (lua_gettable(L, -2) == LUA_TSTRING)
|
||||
r = FreeLater(strdup(lua_tostring(L, -1)));
|
||||
lua_settop(L, top);
|
||||
|
|
Loading…
Reference in a new issue