Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
MalinAhlberg committed Feb 15, 2024
1 parent f4fe380 commit bf6828c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/sda/sda.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,12 @@ func Download(c *gin.Context) {
start, end = calculateEncryptedCoords(start, end, c.GetHeader("Range"), fileDetails)
}
if start == 0 && end == 0 {
log.Debug("setting full file length", contentLength)
c.Header("Content-Length", fmt.Sprint(contentLength))
} else {
// Calculate how much we should read (if given)
togo := end - start
log.Debug("setting full partial length", togo)
c.Header("Content-Length", fmt.Sprint(togo))
}

Expand Down Expand Up @@ -256,6 +258,7 @@ func Download(c *gin.Context) {
switch c.Param("type") {
case "encrypted":
if start > 0 {
c.Header("Content-Length", "0")
log.Errorf("Start coordinate for encrypted files not implemented! %v", start)
c.String(http.StatusBadRequest, "Start coordinate for encrypted files not implemented!")

Expand Down Expand Up @@ -361,6 +364,7 @@ var calculateEncryptedCoords = func(start, end int64, htsget_range string, fileD
b, errB := strconv.ParseInt(startEnd[1], 10, 64)
if errA == nil && errB == nil && a < b {

log.Debug("using range from header", a, b)
return a, b

Check failure on line 368 in api/sda/sda.go

View workflow job for this annotation

GitHub Actions / Check code (1.20)

return with no blank line before (nlreturn)
}
}
Expand All @@ -375,5 +379,6 @@ var calculateEncryptedCoords = func(start, end int64, htsget_range string, fileD
endCoord := packageSize * math.Ceil(bodysize/packageSize)
bodyEnd = int64(math.Min(float64(bodyEnd), endCoord))
}
log.Debug("using range from params", start, headlength.Size()+bodyEnd)
return start, headlength.Size() + bodyEnd

Check failure on line 383 in api/sda/sda.go

View workflow job for this annotation

GitHub Actions / Check code (1.20)

return with no blank line before (nlreturn)
}

0 comments on commit bf6828c

Please sign in to comment.