Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
# Detect the format if still unknown
if format is None:
- format = self._detect_format(line)
+ try:
+ format = self._detect_format(line)
+
+ # Log a warning if we have detected some invalid format
+ except Exception as e:
+ log.warning("Format detection failed for %s: %s" % (self.url, e))
+
+ return False
# Process the line according to its format
match format:
elif util.is_fqdn(line):
return Format.PLAIN
+ # Fail if we have received a HTML document
+ if line.startswith("<"):
+ raise ValueError("Source seems to be in HTML format")
+
# The format is (still?) unknown
return None