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

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

commit a04e1474d84be6e8a092ddff82e883d9a0f01adf
Author: Jesse Rivas <jesse_ri...@comcast.com>
AuthorDate: Wed Apr 18 13:30:00 2018 -0600

    make cdn domain name lowercase before inserting or updating
---
 traffic_ops/traffic_ops_golang/cdn/cdns.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/traffic_ops/traffic_ops_golang/cdn/cdns.go 
b/traffic_ops/traffic_ops_golang/cdn/cdns.go
index 06c381a..ac07497 100644
--- a/traffic_ops/traffic_ops_golang/cdn/cdns.go
+++ b/traffic_ops/traffic_ops_golang/cdn/cdns.go
@@ -136,6 +136,8 @@ func (cdn *TOCDN) Create(db *sqlx.DB, user 
auth.CurrentUser) (error, tc.ApiError
                log.Error.Printf("could not begin transaction: %v", err)
                return tc.DBError, tc.SystemError
        }
+       // make sure that cdn.DomainName is lowercase
+       *cdn.DomainName = strings.ToLower(*cdn.DomainName)
        resultRows, err := tx.NamedQuery(insertQuery(), cdn)
        if err != nil {
                if pqErr, ok := err.(*pq.Error); ok {
@@ -243,6 +245,8 @@ func (cdn *TOCDN) Update(db *sqlx.DB, user 
auth.CurrentUser) (error, tc.ApiError
                return tc.DBError, tc.SystemError
        }
        log.Debugf("about to run exec query: %s with cdn: %++v", updateQuery(), 
cdn)
+       // make sure that cdn.DomainName is lowercase
+       *cdn.DomainName = strings.ToLower(*cdn.DomainName)
        resultRows, err := tx.NamedQuery(updateQuery(), cdn)
        if err != nil {
                if pqErr, ok := err.(*pq.Error); ok {

-- 
To stop receiving notification emails like this one, please contact
els...@apache.org.

Reply via email to