Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

635 B
Raw Blame
package store

import (
	"github.com/pkg/errors"

	storepb "github.com/usememos/memos/proto/gen/store"
)

// ValidateSpaceIcon validates display metadata without depending on a client's
// installed Lucide catalog. A nil icon requests the default Space mark.
func ValidateSpaceIcon(icon *storepb.SpacePayload_Icon) error {
	if icon == nil {
		return nil
	}
	switch value := icon.Value.(type) {
	case *storepb.SpacePayload_Icon_Emoji:
		return validateEmojiIcon(value.Emoji)
	case *storepb.SpacePayload_Icon_Lucide:
		return validateLucideIcon(value.Lucide)
	default:
		return errors.New("space icon must specify emoji or lucide")
	}
}