Skip to content

Commit

Permalink
Fix mmcif check
Browse files Browse the repository at this point in the history
  • Loading branch information
milot-mirdita committed Jul 9, 2024
1 parent c3dc62c commit 5d16b2f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ func ismmCIFFile(filePath string) (bool, error) {
}
defer file.Close()

firstLine := ""
scanner := bufio.NewScanner(file)
for scanner.Scan() {
firstLine := scanner.Text()
firstLine = scanner.Text()
if strings.TrimSpace(firstLine) != "" {
break
}
Expand All @@ -111,11 +112,10 @@ func ismmCIFFile(filePath string) (bool, error) {
if err := scanner.Err(); err != nil {
return false, err
}
if !scanner.Scan() {
if firstLine == "" {
return false, errors.New("empty file")
}

firstLine := scanner.Text()
if strings.HasPrefix(firstLine, "# ") || strings.HasPrefix(firstLine, "data_") {
return true, nil
}
Expand Down

0 comments on commit 5d16b2f

Please sign in to comment.