소스 검색

fix: windows separator is not consistent with zip

Yeuoly 7 달 전
부모
커밋
d0397519ec
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      internal/core/plugin_packager/packager/packager.go

+ 5 - 0
internal/core/plugin_packager/packager/packager.go

@@ -6,6 +6,7 @@ import (
 	"errors"
 	"path/filepath"
 	"strconv"
+	"strings"
 
 	"github.com/langgenius/dify-plugin-daemon/internal/core/plugin_packager/decoder"
 )
@@ -45,6 +46,10 @@ func (p *Packager) Pack(maxSize int64) ([]byte, error) {
 			return errors.New("plugin package size is too large, please ensure the uncompressed size is less than " + strconv.FormatInt(maxSize, 10) + " bytes")
 		}
 
+		// ISSUES: Windows path separator is \, but zip requires /, to avoid this we just simply replace all \ with / for now
+		// TODO: find a better solution
+		fullPath = strings.ReplaceAll(fullPath, "\\", "/")
+
 		zipFile, err := zipWriter.Create(fullPath)
 		if err != nil {
 			return err