[1.2] 리플레이
- 리플레이 파일 이름 유지하도록 수정
This commit is contained in:
@ -101,6 +101,7 @@ type uploadRequest struct {
|
||||
filePath string
|
||||
name string
|
||||
version string
|
||||
uploadedFileName string
|
||||
}
|
||||
|
||||
type houstonClient struct {
|
||||
@ -503,7 +504,7 @@ func NewClient(standalone bool) (HoustonClient, error) {
|
||||
return hc, nil
|
||||
}
|
||||
|
||||
func uploadSafe(url, filePath, name, version string) error {
|
||||
func uploadSafe(url, filePath, name, version, uploadedFileName string) error {
|
||||
defer func() {
|
||||
r := recover()
|
||||
if r != nil {
|
||||
@ -537,7 +538,10 @@ func uploadSafe(url, filePath, name, version string) error {
|
||||
// createTime := file.
|
||||
httpreq.Header.Set("Houston-Service-Name", name)
|
||||
httpreq.Header.Set("Houston-Service-Version", version)
|
||||
httpreq.Header.Set("Houston-Service-Filename", t.BirthTime().UTC().Format(time.DateOnly)+"."+hn+path.Ext(filePath))
|
||||
if len(uploadedFileName) == 0 {
|
||||
uploadedFileName = t.BirthTime().UTC().Format(time.DateOnly) + "." + hn + path.Ext(filePath)
|
||||
}
|
||||
httpreq.Header.Set("Houston-Service-Filename", uploadedFileName)
|
||||
httpreq.Header.Set("Content-Type", "application/zip")
|
||||
resp, err := http.DefaultClient.Do(httpreq)
|
||||
if err != nil {
|
||||
@ -581,7 +585,7 @@ func (hc *houstonClient) Start() {
|
||||
url := hc.config.HttpAddress + "/upload"
|
||||
for req := range hc.uploadChan {
|
||||
logger.Println("uploadSafe :", req)
|
||||
err := uploadSafe(url, req.filePath, req.name, req.version)
|
||||
err := uploadSafe(url, req.filePath, req.name, req.version, req.uploadedFileName)
|
||||
if err != nil {
|
||||
logger.Println("uploadSafe return err :", err)
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -129,7 +130,7 @@ func handleStdOutUploadRequest(hc *houstonClient, meta *procmeta, param string)
|
||||
if _, err := os.Stat(uploadFullPath); err != nil {
|
||||
return err
|
||||
} else {
|
||||
hc.uploadToAppendFile(uploadFullPath, meta.name, meta.version)
|
||||
hc.uploadToAppendFile(uploadFullPath, meta.name, meta.version, filepath.Base(uploadFullPath))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -44,11 +44,12 @@ func lastExecutionArgs(verpath string) []string {
|
||||
return out
|
||||
}
|
||||
|
||||
func (hc *houstonClient) uploadToAppendFile(filePath string, name string, version string) {
|
||||
func (hc *houstonClient) uploadToAppendFile(filePath string, name string, version string, uploadedFileName string) {
|
||||
hc.uploadChan <- uploadRequest{
|
||||
filePath: filePath,
|
||||
name: name,
|
||||
version: version,
|
||||
uploadedFileName: uploadedFileName,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user