Skip to content

Commit

Permalink
SECURITY-10102: add error handling to date parsing
Browse files Browse the repository at this point in the history
Co-authored-by: Laszlo Losonczy <[email protected]>
  • Loading branch information
Borcsa134 and losonczylaci committed Jan 23, 2025
1 parent 62f9058 commit 58da5a9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion escher.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"
"sort"
"time"
"log"
"net/url"
"regexp"
. "github.com/PuerkitoBio/purell"
Expand Down Expand Up @@ -195,7 +196,10 @@ func (config EscherConfig) getDefaultHeaders(headers EscherRequestHeaders) Esche
if !hasHeader(config.DateHeaderName, headers) {
dateHeader := config.Date
if strings.ToLower(config.DateHeaderName) == "date" {
var t, _ = time.Parse("20060102T150405Z", config.Date)
t, err := time.Parse("20060102T150405Z", config.Date)
if err != nil {
log.Println("Error parsing date header")
}
dateHeader = t.Format("Fri, 02 Jan 2006 15:04:05 GMT")
}
newHeaders = append(newHeaders, [2]string { config.DateHeaderName, dateHeader })
Expand Down

0 comments on commit 58da5a9

Please sign in to comment.