Skip to content

Commit

Permalink
fix: sanitate exam name to be oneline string
Browse files Browse the repository at this point in the history
  • Loading branch information
Adventune committed Feb 6, 2024
1 parent 99a54f7 commit 6478011
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ codes.txt
*.mex
.mexer-temp
tmp
test/

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
Expand Down
5 changes: 5 additions & 0 deletions src/executable/crypto/decrypt-file.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,10 @@ func DecryptFile(filePath string, key []byte, iv []byte) (success bool, examName
examName = strings.Split(string(decryptedResult), "<e:exam-title>")[1]
examName = strings.Split(examName, "</e:exam-title>")[0]

// Sanitate exam name to a one line string
examName = strings.ReplaceAll(examName, "\n", " ")
examName = strings.ReplaceAll(examName, "<br/>", " ")
examName = strings.TrimSpace(examName)

return true, examName
}

0 comments on commit 6478011

Please sign in to comment.