This is an automated email from the ASF dual-hosted git repository.

rawlin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 2ae695b  Appropriate path join (#4607)
2ae695b is described below

commit 2ae695ba6db64089272f87ae6df0c73440590949
Author: ocket8888 <[email protected]>
AuthorDate: Tue Apr 7 11:08:36 2020 -0600

    Appropriate path join (#4607)
    
    * Made TM HTTP Server use appropriate path joining functions
    
    * gofmt
---
 lib/go-rfc/mimetype.go                                        | 4 ++--
 traffic_monitor/srvhttp/srvhttp.go                            | 7 ++++---
 traffic_ops/client/crconfig.go                                | 1 -
 traffic_ops/traffic_ops_golang/physlocation/phys_locations.go | 6 +++---
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/go-rfc/mimetype.go b/lib/go-rfc/mimetype.go
index ff7eeb0..85d9505 100644
--- a/lib/go-rfc/mimetype.go
+++ b/lib/go-rfc/mimetype.go
@@ -260,12 +260,12 @@ var MIME_HTML = MimeType{
 
 // MIME_CSS is a pre-defined MimeType for CSS data.
 var MIME_CSS = MimeType{
-       Name: "text/css",
+       Name:       "text/css",
        Parameters: map[string]string{"charset": "utf-8"},
 }
 
 // MIME_JS is a pre-defined MimeType for JavaScript data.
 var MIME_JS = MimeType{
-       Name: "text/javascript",
+       Name:       "text/javascript",
        Parameters: map[string]string{"charset": "utf-8"},
 }
diff --git a/traffic_monitor/srvhttp/srvhttp.go 
b/traffic_monitor/srvhttp/srvhttp.go
index c1fdff1..e3dd673 100644
--- a/traffic_monitor/srvhttp/srvhttp.go
+++ b/traffic_monitor/srvhttp/srvhttp.go
@@ -25,6 +25,7 @@ import (
        "net"
        "net/http"
        "net/url"
+       "path"
        "strings"
        "sync"
        "time"
@@ -229,11 +230,11 @@ func DateStr(t time.Time) string {
 }
 
 func (s *Server) handleRootFunc(staticFileDir string) (http.HandlerFunc, 
error) {
-       return s.handleFile(staticFileDir + "index.html")
+       return s.handleFile(path.Join(staticFileDir, "index.html"))
 }
 
 func (s *Server) handleScriptFunc(staticFileDir string) (http.HandlerFunc, 
error) {
-       bytes, err := ioutil.ReadFile(staticFileDir + "script.js")
+       bytes, err := ioutil.ReadFile(path.Join(staticFileDir, "script.js"))
        if err != nil {
                return nil, err
        }
@@ -244,7 +245,7 @@ func (s *Server) handleScriptFunc(staticFileDir string) 
(http.HandlerFunc, error
 }
 
 func (s *Server) handleStyleFunc(staticFileDir string) (http.HandlerFunc, 
error) {
-       bytes, err := ioutil.ReadFile(staticFileDir + "style.css")
+       bytes, err := ioutil.ReadFile(path.Join(staticFileDir, "style.css"))
        if err != nil {
                return nil, err
        }
diff --git a/traffic_ops/client/crconfig.go b/traffic_ops/client/crconfig.go
index 27f15de..8260507 100644
--- a/traffic_ops/client/crconfig.go
+++ b/traffic_ops/client/crconfig.go
@@ -67,4 +67,3 @@ func (to *Session) SnapshotCRConfigByID(id int) (tc.Alerts, 
ReqInf, error) {
        err = json.NewDecoder(resp.Body).Decode(&alerts)
        return alerts, reqInf, nil
 }
-
diff --git a/traffic_ops/traffic_ops_golang/physlocation/phys_locations.go 
b/traffic_ops/traffic_ops_golang/physlocation/phys_locations.go
index cdfbc5a..42817a0 100644
--- a/traffic_ops/traffic_ops_golang/physlocation/phys_locations.go
+++ b/traffic_ops/traffic_ops_golang/physlocation/phys_locations.go
@@ -104,9 +104,9 @@ func (pl *TOPhysLocation) Read() ([]interface{}, error, 
error, int) {
        }
        return api.GenericRead(pl)
 }
-func (pl *TOPhysLocation) Update() (error, error, int)              { return 
api.GenericUpdate(pl) }
-func (pl *TOPhysLocation) Create() (error, error, int)              { return 
api.GenericCreate(pl) }
-func (pl *TOPhysLocation) Delete() (error, error, int)              { return 
api.GenericDelete(pl) }
+func (pl *TOPhysLocation) Update() (error, error, int) { return 
api.GenericUpdate(pl) }
+func (pl *TOPhysLocation) Create() (error, error, int) { return 
api.GenericCreate(pl) }
+func (pl *TOPhysLocation) Delete() (error, error, int) { return 
api.GenericDelete(pl) }
 
 func selectQuery() string {
        return `

Reply via email to