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:
parent
f08a002294
commit
93e44b72d9
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user