diff options
author | Sebastian Pipping <sebastian@pipping.org> | 2014-10-06 04:42:06 +0200 |
---|---|---|
committer | Sebastian Pipping <sebastian@pipping.org> | 2014-10-24 22:42:08 +0200 |
commit | 1e357447364a118ff284148a3be862d7969a36d5 (patch) | |
tree | b77c31adb632b3c5c1ae1daf264d653ab796cb32 | |
parent | fix homepage (diff) | |
download | elogv-1e357447364a118ff284148a3be862d7969a36d5.tar.gz elogv-1e357447364a118ff284148a3be862d7969a36d5.tar.bz2 elogv-1e357447364a118ff284148a3be862d7969a36d5.zip |
Make log filename parsing more robust (Gentoo bug 503904)
-rwxr-xr-x | elogv | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -370,9 +370,11 @@ class ElogViewer: # then we split the string using as pattern / or : to obtain in any # case # ( "x11-themes", "haematite-xcursors", "1.0:20091018-195827.log") - if not filepath.endswith == ".log": - tmpfilepath = re.sub('\.log.*$', '.log', filepath) - (cat,pn,other) = re.split(":|" + os.path.sep, tmpfilepath.replace(elogdir + os.path.sep, "") ) + tmpfilepath = re.sub('\.log.*$', '.log', filepath) + split_up = re.split(":|" + os.path.sep, tmpfilepath.replace(elogdir + os.path.sep, "")) + if len(split_up) < 3: + continue + (cat, pn, other) = split_up[-3:] if sys.version_info[:2] >= (2, 5): date = datetime.strptime(other, "%Y%m%d-%H%M%S.log") else: |