fix(GODT-2447): Don't assume timestamp exists in log filename
This commit is contained in:
parent
8aec11a634
commit
53d5619c51
|
@ -144,7 +144,14 @@ func getLogName(version, revision string) string {
|
|||
func getLogTime(name string) int {
|
||||
re := regexp.MustCompile(`^v.*_.*_(?P<timestamp>\d+).log$`)
|
||||
|
||||
timestamp, err := strconv.Atoi(re.FindStringSubmatch(name)[re.SubexpIndex("timestamp")])
|
||||
match := re.FindStringSubmatch(name)
|
||||
|
||||
if len(match) == 0 {
|
||||
logrus.Warn("Could not parse log name: ", name)
|
||||
return 0
|
||||
}
|
||||
|
||||
timestamp, err := strconv.Atoi(match[re.SubexpIndex("timestamp")])
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue