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:
@@ -26,13 +26,8 @@ func InitNotes(config *NotesConfig) *Notes {
|
||||
}
|
||||
}
|
||||
|
||||
// ParsePath resolves a user-supplied request path to an absolute path inside
|
||||
// the notes directory, or returns an error if it would escape.
|
||||
//
|
||||
// The traversal guard is the prefix check at the end. filepath.Join already
|
||||
// cleans "..", but the separator is appended to baseDir before comparing so
|
||||
// that a sibling directory whose name merely starts with the same characters
|
||||
// (e.g. /backend/notes-private next to /backend/notes) cannot pass the check.
|
||||
// ParsePath appends the separator before the prefix check, so a sibling such
|
||||
// as /backend/notes-private can't pass.
|
||||
func (notes *Notes) ParsePath(path string) (string, error) {
|
||||
// The route is /notes/*path, so a bare /notes/ arrives as "" or "/";
|
||||
// treat both as a request for the wiki index.
|
||||
|
||||
Reference in New Issue
Block a user