1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-04 09:17:32 -05:00

rework the file name checking logic

This commit is contained in:
Shelikhoo 2021-04-03 10:14:23 +01:00
parent f08a002294
commit 93e44b72d9
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316
2 changed files with 3 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"crypto/sha256" "crypto/sha256"
"encoding/hex" "encoding/hex"
"path/filepath"
"strings" "strings"
"github.com/v2fly/VSign/insmgr" "github.com/v2fly/VSign/insmgr"
@ -18,7 +19,8 @@ type EmbeddedHashProtectedLoader struct {
} }
func (e EmbeddedHashProtectedLoader) VerifyAndLoad(filename string) ([]byte, error) { func (e EmbeddedHashProtectedLoader) VerifyAndLoad(filename string) ([]byte, error) {
filecontent, err := filesystem.ReadFile(platform.GetAssetLocation(filename)) platformFileName := filepath.FromSlash(filename)
filecontent, err := filesystem.ReadFile(platform.GetAssetLocation(platformFileName))
if err != nil { if err != nil {
return nil, newError("Cannot find file", filename).Base(err) return nil, newError("Cannot find file", filename).Base(err)
} }

View File

@ -1,9 +1,6 @@
package securedload package securedload
import "path/filepath"
func GetAssetSecured(name string) ([]byte, error) { func GetAssetSecured(name string) ([]byte, error) {
name = filepath.FromSlash(name)
var err error var err error
for k, v := range knownProtectedLoader { for k, v := range knownProtectedLoader {