Trim comments to the non-obvious why
Drop narration, history and restated-code comments across the repo, keep short ones for security boundaries, upstream quirks and ordering constraints, and record the convention in CLAUDE.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -7,10 +7,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// GetNoteFile serves one file from the notes directory for the admin-only
|
||||
// route GET /notes/*path. The wildcard means `path` arrives with a leading
|
||||
// slash and may contain further slashes, so it has to be validated rather
|
||||
// than trusted — Notes.ParsePath does the containment check.
|
||||
// GetNoteFile: Notes.ParsePath does the containment check.
|
||||
|
||||
func (store *Store) GetNoteFile(ctx *gin.Context) {
|
||||
path := ctx.Param("path")
|
||||
@@ -29,9 +26,7 @@ func (store *Store) GetNoteFile(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// The SPA reads Last-Modified to show a note's edit date. Browsers hide
|
||||
// non-safelisted headers from cross-origin fetch() unless they are listed
|
||||
// in Access-Control-Expose-Headers, hence the second header.
|
||||
// Exposed so cross-origin fetch() can read it.
|
||||
ctx.Header("Last-Modified", info.ModTime().UTC().Format(http.TimeFormat))
|
||||
ctx.Header("Access-Control-Expose-Headers", "Content-Disposition, Last-Modified")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user