Commit 451a8511 authored by erio's avatar erio
Browse files

fix: remove unused sanitizeCustomMenuItemsJSON function



Replaced by filterUserVisibleMenuItems which includes both array
validation and admin-item filtering.
Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
parent e97c3766
......@@ -244,22 +244,6 @@ func (s *SettingService) GetPublicSettingsForInjection(ctx context.Context) (any
}, nil
}
// sanitizeCustomMenuItemsJSON validates a raw JSON string is a valid JSON array
// and returns it as json.RawMessage. Returns "[]" if the input is empty, not a
// valid JSON array, or is a non-array JSON value (e.g. object, string).
func sanitizeCustomMenuItemsJSON(raw string) json.RawMessage {
raw = strings.TrimSpace(raw)
if raw == "" || raw == "[]" {
return json.RawMessage("[]")
}
// Verify it's actually a JSON array, not an object or other type
var arr []json.RawMessage
if err := json.Unmarshal([]byte(raw), &arr); err != nil {
return json.RawMessage("[]")
}
return json.RawMessage(raw)
}
// filterUserVisibleMenuItems filters out admin-only menu items from a raw JSON
// array string, returning only items with visibility != "admin".
func filterUserVisibleMenuItems(raw string) json.RawMessage {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment