Skip to content

Commit 3cae5bb

Browse files
committed
fix log
1 parent 2c99a44 commit 3cae5bb

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

connector.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (p *Payload) ReadableSize() string {
3434

3535
func (p *Payload) GetContent(nofix bool) (cont []byte, err error) {
3636
defer runtime.GC()
37-
if nofix || !shouldBeFix(p.Name) {
37+
if nofix || !p.ShouldBeFix() {
3838
cont, err = io.ReadAll(p.File)
3939
} else {
4040
cont, err = postProcess(p.File)
@@ -43,6 +43,10 @@ func (p *Payload) GetContent(nofix bool) (cont []byte, err error) {
4343
return cont, err
4444
}
4545

46+
func (p *Payload) ShouldBeFix() bool {
47+
return shouldBeFix(p.Name)
48+
}
49+
4650
func NewPayload(file io.Reader, name string, size int64) *Payload {
4751
return &Payload{
4852
File: file,

connector_http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (hc *HTTPConnector) Upload(payload *Payload) (err error) {
145145
log.SetOutput(os.Stderr)
146146
if err != nil {
147147
log.Printf("G-Code fix error(ignored): %s", err)
148-
} else {
148+
} else if payload.ShouldBeFix() {
149149
log.Printf("G-Code fixed")
150150
}
151151
log.SetOutput(w)

connector_sacp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (sc *SACPConnector) Upload(payload *Payload) (err error) {
5252
if !NoFix {
5353
if err != nil {
5454
log.Printf("G-Code fix error(ignored): %s", err)
55-
} else {
55+
} else if payload.ShouldBeFix() {
5656
log.Printf("G-Code fixed")
5757
}
5858
}

0 commit comments

Comments
 (0)