Skip to content

Commit

Permalink
Removed newline characters from precomputed etags
Browse files Browse the repository at this point in the history
  • Loading branch information
armadi1809 committed Jun 13, 2024
1 parent 8e0d3e1 commit 4d3a752
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/caddyhttp/fileserver/staticfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,12 @@ func (fsrv *FileServer) getEtagFromFile(fileSystem fs.FS, filename string) (stri
if err != nil {
return "", fmt.Errorf("cannot read etag from file %s: %v", etagFilename, err)
}
return string(etag), nil
etagStr := string(etag)

// Etags should not contain newline characters
etagStr = strings.ReplaceAll(etagStr, "\n", "")

return etagStr, nil
}
return "", nil
}
Expand Down

0 comments on commit 4d3a752

Please sign in to comment.