]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix creating of URLs from LUA
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 23 Apr 2016 11:37:15 +0000 (12:37 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 23 Apr 2016 13:45:27 +0000 (14:45 +0100)
src/lua/lua_url.c

index 3e97bbd11eede6f70abd8c989bc90f7fc606c5c8..24c3f9a701e4ef99fccfe3f3a985649528ad099c 100644 (file)
@@ -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);