From 99e5dcf7c7354852b5a90dfab31ebb099f1cbad2 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 23 Apr 2016 12:37:15 +0100 Subject: [PATCH] [Fix] Fix creating of URLs from LUA --- src/lua/lua_url.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c index 3e97bbd11..24c3f9a70 100644 --- a/src/lua/lua_url.c +++ b/src/lua/lua_url.c @@ -487,10 +487,14 @@ lua_url_create (lua_State *L) text = luaL_checklstring (L, 2, &length); if (text != NULL) { - lua_newtable (L); rspamd_url_find_single (pool, text, length, FALSE, lua_url_single_inserter, L); + if (lua_type (L, -1) != LUA_TUSERDATA) { + /* URL is actually not found */ + lua_pushnil (L); + } + } else { lua_pushnil (L); -- 2.39.5