package musicfs import ( "path/filepath" "strings" "github.com/rs/zerolog/log" ) func DeriveSubdir(originRoot, contentPath string) string { rel, err := filepath.Rel(originRoot, contentPath) if err != nil || strings.HasPrefix(rel, "..") { log.Warn(). Str("origin_root", originRoot). Str("content_path", contentPath). Msg("content path outside origin root, falling back to full rescan") return "" } return rel }