|
@@ -4,6 +4,7 @@ import (
|
|
|
"archive/zip"
|
|
|
"bytes"
|
|
|
"io"
|
|
|
+ "path/filepath"
|
|
|
"strings"
|
|
|
|
|
|
"github.com/langgenius/dify-plugin-daemon/internal/types/entities/bundle_entities"
|
|
@@ -63,7 +64,7 @@ func NewMemoryZipBundlePackager(zipFile []byte) (*MemoryZipBundlePackager, error
|
|
|
// walk through the zip file and load the assets
|
|
|
for _, file := range zipReader.File {
|
|
|
// if file starts with "_assets/"
|
|
|
- if strings.HasPrefix(file.Name, "_assets/") {
|
|
|
+ if strings.HasPrefix(file.Name, "_assets"+string(filepath.Separator)) {
|
|
|
// load the asset
|
|
|
asset, err := file.Open()
|
|
|
if err != nil {
|
|
@@ -77,7 +78,7 @@ func NewMemoryZipBundlePackager(zipFile []byte) (*MemoryZipBundlePackager, error
|
|
|
}
|
|
|
|
|
|
// trim the prefix "_assets/"
|
|
|
- assetName := strings.TrimPrefix(file.Name, "_assets/")
|
|
|
+ assetName := strings.TrimPrefix(file.Name, "_assets"+string(filepath.Separator))
|
|
|
|
|
|
packager.assets[assetName] = bytes.NewBuffer(assetBytes)
|
|
|
}
|