Skip to content

Commit

Permalink
Simplify GenerateWarcFileName
Browse files Browse the repository at this point in the history
  • Loading branch information
vbanos authored and CorentinB committed Jan 20, 2025
1 parent c11bcf6 commit 79e5fb7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,15 @@ func GenerateWarcFileName(prefix string, compression string, atomicSerial *int64
now := time.Now().UTC()
date := now.Format("20060102150405") + strconv.Itoa(now.Nanosecond())[:3]

if compression != "" {
if compression == "GZIP" {
return prefix + "-" + date + "-" + formattedSerial + "-" + hostName + ".warc.gz.open"
}
if compression == "ZSTD" {
return prefix + "-" + date + "-" + formattedSerial + "-" + hostName + ".warc.zst.open"
}
var fileExt string
if compression == "GZIP" {
fileExt = ".warc.gz.open"
} else if compression == "ZSTD" {
fileExt = ".warc.zst.open"
} else {
fileExt = ".warc.open"
}
return prefix + "-" + date + "-" + formattedSerial + "-" + hostName + ".warc.open"
return prefix + "-" + date + "-" + formattedSerial + "-" + hostName + fileExt
}

func getContentLength(rwsc spooledtempfile.ReadWriteSeekCloser) int {
Expand Down

0 comments on commit 79e5fb7

Please sign in to comment.