1
0
Эх сурвалжийг харах

Check scanner error in GetXrayLogs

Add a check for scanner.Err() after scanning log lines and return nil if an error occurred. This prevents further processing of potentially incomplete or invalid log entries when the scanner encountered an error.
MHSanaei 1 өдөр өмнө
parent
commit
fb75e3d7c7
1 өөрчлөгдсөн 4 нэмэгдсэн , 0 устгасан
  1. 4 0
      web/service/server.go

+ 4 - 0
web/service/server.go

@@ -846,6 +846,10 @@ func (s *ServerService) GetXrayLogs(
 		entries = append(entries, entry)
 	}
 
+	if err := scanner.Err(); err != nil {
+		return nil
+	}
+
 	if len(entries) > countInt {
 		entries = entries[len(entries)-countInt:]
 	}