Commit 749e9ebc55a6748e1fd334169e14ae99fe6f5338

Authored by Christian Herdtweck
1 parent cbd3f779

deal with 2 errors that appeared in first tests (and corrected an indentation)

Showing 1 changed file with 6 additions and 2 deletions
oletools/olevba.py
... ... @@ -2174,6 +2174,7 @@ class VBA_Parser(object):
2174 2174 except Exception as exc:
2175 2175 # TODO: differentiate exceptions for each parsing stage
2176 2176 # (but ET is different libs, no good exception description in API)
  2177 + # found: XMLSyntaxError
2177 2178 log.exception('Failed XML parsing for file %r (%s)' % (self.filename, exc))
2178 2179  
2179 2180 def open_mht(self, data):
... ... @@ -2230,12 +2231,15 @@ class VBA_Parser(object):
2230 2231 % (fname, exc))
2231 2232 else:
2232 2233 log.debug('type(part_data) = %s' % type(part_data))
2233   - log.debug('part_data[0:20] = %r' % part_data[0:20])
  2234 + try:
  2235 + log.debug('part_data[0:20] = %r' % part_data[0:20])
  2236 + except TypeError as err:
  2237 + log.debug('part_data has no __getitem__')
2234 2238 # set type only if parsing succeeds
2235 2239 self.type = TYPE_MHTML
2236 2240 except Exception:
2237 2241 log.exception('Failed MIME parsing for file %r - %s'
2238   - % (self.filename, MSG_OLEVBA_ISSUES))
  2242 + % (self.filename, MSG_OLEVBA_ISSUES))
2239 2243  
2240 2244  
2241 2245 def open_text(self, data):
... ...