Skip to content

Commit 2630276

Browse files
sandeepmistrymatteosuppo
authored andcommitted
Only check command signature in non-network mode (#97)
* Only check command signature in non-network mode Signed-off-by: Sandeep Mistry <s.mistry@arduino.cc> * Add missing return for saveFileonTempDir error
1 parent 79a7f8f commit 2630276

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

conn.go

+11-10
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,17 @@ func uploadHandler(c *gin.Context) {
7474
return
7575
}
7676

77-
if data.Signature == "" {
78-
c.String(http.StatusBadRequest, "signature is required")
79-
return
80-
}
77+
if data.Extra.Network == false {
78+
if data.Signature == "" {
79+
c.String(http.StatusBadRequest, "signature is required")
80+
return
81+
}
82+
83+
if data.Commandline == "" {
84+
c.String(http.StatusBadRequest, "commandline is required for local board")
85+
return
86+
}
8187

82-
if data.Extra.Network {
8388
err := verifyCommandLine(data.Commandline, data.Signature)
8489

8590
if err != nil {
@@ -88,16 +93,12 @@ func uploadHandler(c *gin.Context) {
8893
}
8994
}
9095

91-
if data.Extra.Network == false && data.Commandline == "" {
92-
c.String(http.StatusBadRequest, "commandline is required for local board")
93-
return
94-
}
95-
9696
buffer := bytes.NewBuffer(data.Hex)
9797

9898
path, err := saveFileonTempDir(data.Filename, buffer)
9999
if err != nil {
100100
c.String(http.StatusBadRequest, err.Error())
101+
return
101102
}
102103

103104
if data.Rewrite != "" {

0 commit comments

Comments
 (0)