Commit 970de49
Eric Bower
·
2026-03-02 09:19:20 -0500 EST
parent fb101af
fix(pgs): ability to pipe files to pgs
2 files changed,
+9,
-0
+4,
-0
| ... | ... | @@ -36,6 +36,10 @@ func Middleware(writeHandler utils.CopyFromClientHandler, ext string) pssh.SSHSe | |
| 36 | 36 | if name == "" { | |
| 37 | 37 | name = fmt.Sprintf("%s%s", strconv.Itoa(int(postTime.UnixNano())), ext) | |
| 38 | 38 | } | |
| 39 | + | // add a `/` prefix mainly for pgs support | |
| 40 | + | if !strings.HasPrefix(name, "/") { | |
| 41 | + | name = "/" + name | |
| 42 | + | } | |
| 39 | 43 | ||
| 40 | 44 | result, err := writeHandler.Write(session, &utils.FileEntry{ | |
| 41 | 45 | Filepath: name, |
| ... | ... | @@ -24,6 +24,11 @@ func GetProjectName(entry *utils.FileEntry) string { | |
| 24 | 24 | ||
| 25 | 25 | dir := filepath.Dir(entry.Filepath) | |
| 26 | 26 | list := strings.Split(dir, string(os.PathSeparator)) | |
| 27 | + | if len(list) == 0 { | |
| 28 | + | return "" | |
| 29 | + | } else if len(list) == 1 { | |
| 30 | + | return list[0] | |
| 31 | + | } | |
| 27 | 32 | return list[1] | |
| 28 | 33 | } | |
| 29 | 34 |