fix: allow files in extension spec

Support allowing explicit files in extensions.

Signed-off-by: Noel Georgi <git@frezbo.dev>
This commit is contained in:
Noel Georgi 2022-08-03 02:28:51 +05:30
parent 1a8f6ec8e1
commit f95b537262
No known key found for this signature in database
GPG Key ID: B1F736354201D483
2 changed files with 2 additions and 4 deletions

View File

@ -76,13 +76,11 @@ func (ext *Extension) validateContents() error {
// regular file: check for file path being whitelisted
if !d.IsDir() {
dirPath := filepath.Dir(itemPath)
allowed := false
for _, allowedPath := range extensions.AllowedPaths {
if strings.HasPrefix(dirPath, allowedPath) {
_, err = filepath.Rel(allowedPath, dirPath)
if strings.HasPrefix(itemPath, allowedPath) {
_, err = filepath.Rel(allowedPath, itemPath)
if err == nil {
allowed = true