@@ -21,6 +21,7 @@ import (
2121 "net/url"
2222 "os"
2323 "os/signal"
24+ "path"
2425 "path/filepath"
2526 "runtime"
2627 "strconv"
@@ -213,7 +214,7 @@ func main() {
213214
214215 useMBID := r .FormValue ("mbid" )
215216 if strings .Contains (useMBID , "/" ) {
216- useMBID = filepath .Base (useMBID ) // accept release URL
217+ useMBID = path .Base (useMBID ) // accept release URL
217218 }
218219
219220 ctx := r .Context ()
@@ -298,25 +299,25 @@ func main() {
298299 http .Error (w , err .Error (), http .StatusBadRequest )
299300 return
300301 }
301- path := r .FormValue ("path" )
302- if path == "" {
302+ pth := r .FormValue ("path" )
303+ if pth == "" {
303304 http .Error (w , "no path provided" , http .StatusBadRequest )
304305 return
305306 }
306- if ! filepath .IsAbs (path ) {
307+ if ! filepath .IsAbs (pth ) {
307308 http .Error (w , "filepath not abs" , http .StatusBadRequest )
308309 return
309310 }
310- path = filepath .Clean (path )
311+ pth = filepath .Clean (pth )
311312 useMBID := r .FormValue ("mbid" )
312313 if strings .Contains (useMBID , "/" ) {
313- useMBID = filepath .Base (useMBID ) // accept release URL
314+ useMBID = path .Base (useMBID ) // accept release URL
314315 }
315316
316317 ctx := r .Context ()
317318
318319 var job Job
319- if err := sqlb .ScanRow (ctx , db , & job , "insert into jobs (source_path, operation, use_mbid, time) values (?, ?, ?, ?) returning *" , path , operationStr , useMBID , time .Now ()); err != nil {
320+ if err := sqlb .ScanRow (ctx , db , & job , "insert into jobs (source_path, operation, use_mbid, time) values (?, ?, ?, ?) returning *" , pth , operationStr , useMBID , time .Now ()); err != nil {
320321 http .Error (w , fmt .Sprintf ("error saving job: %v" , err ), http .StatusInternalServerError )
321322 return
322323 }
0 commit comments