|
|
@@ -20,16 +20,16 @@ type EmbeddedHashProtectedLoader struct {
|
|
|
|
|
|
func (e EmbeddedHashProtectedLoader) VerifyAndLoad(filename string) ([]byte, error) {
|
|
|
platformFileName := filepath.FromSlash(filename)
|
|
|
- filecontent, err := filesystem.ReadFile(platform.GetAssetLocation(platformFileName))
|
|
|
+ fileContent, err := filesystem.ReadFile(platform.GetAssetLocation(platformFileName))
|
|
|
if err != nil {
|
|
|
return nil, newError("Cannot find file", filename).Base(err)
|
|
|
}
|
|
|
- fileHash := sha256.Sum256(filecontent)
|
|
|
+ fileHash := sha256.Sum256(fileContent)
|
|
|
fileHashAsString := hex.EncodeToString(fileHash[:])
|
|
|
- if filenameverified, ok := e.checkedFile[fileHashAsString]; ok {
|
|
|
- for _, filenameVerifiedIndividual := range strings.Split(filenameverified, ";") {
|
|
|
+ if fileNameVerified, ok := e.checkedFile[fileHashAsString]; ok {
|
|
|
+ for _, filenameVerifiedIndividual := range strings.Split(fileNameVerified, ";") {
|
|
|
if strings.HasSuffix(filenameVerifiedIndividual, filename) {
|
|
|
- return filecontent, nil
|
|
|
+ return fileContent, nil
|
|
|
}
|
|
|
}
|
|
|
}
|