Skip to content

Commit 0e46dc1

Browse files
committed
dzVents Stricter check on xml
1 parent f225575 commit 0e46dc1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

dzVents/runtime/Utils.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ function self.isXML(str, content)
266266
local str = str or ''
267267
local content = content or ''
268268
local xmlPattern = '^%s*%<.+%>%s*$'
269-
local ret = str:match(xmlPattern) == str or content:find('application/xml') or content:find('text/xml')
270-
return ret ~= nil
269+
local ret = ( str:match(xmlPattern) == str or content:find('application/xml') or content:find('text/xml')) and not(str:sub(1,30):find('DOCTYPE html') )
270+
return ret
271271

272272
end
273273

@@ -297,11 +297,10 @@ function self.fromXML(xml, fallback)
297297
if (ok) then
298298
return results
299299
end
300-
self.log('Error parsing xml to Lua table: ' .. _.str(results), self.LOG_ERROR)
300+
-- self.log('Error parsing xml to Lua table: ' .. _.str(results), self.LOG_ERROR)
301301
else
302302
self.log('Error parsing xml to LUA table: (invalid xml string) ' .. _.str(xml) , self.LOG_ERROR)
303303
end
304-
305304
return fallback
306305

307306
end

0 commit comments

Comments
 (0)