Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find better solution than sprintf in lib.Node diff function #142

Open
kpelzel opened this issue Dec 12, 2019 · 0 comments
Open

Find better solution than sprintf in lib.Node diff function #142

kpelzel opened this issue Dec 12, 2019 · 0 comments
Milestone

Comments

@kpelzel
Copy link
Contributor

kpelzel commented Dec 12, 2019

#140 replaces lib.urlpush with sprintf to avoid a beginning slash. A beginning slash will cause issues with the SME because it filters out any STATE_CHANGE events that contain extensions with a leading slash. This solution is not ideal, but was passed in due to a time crunch.

related to PR: #115

These problems occur in lib.Node.Diff()

	// handle extensions
	for _, u := range eright {
		nodeExt, ok := m.exts[u]
		if !ok {
			r = append(r, lib.URLPush(prefix, u))
			r = append(r, fmt.Sprintf("%s%s", prefix, u))
			continue
		}
		d, _ := lib.MessageDiff(n.exts[u], nodeExt, lib.URLPush(prefix, u))
		d, _ := lib.MessageDiff(n.exts[u], nodeExt, fmt.Sprintf("%s%s", prefix, u))
		r = append(r, d...)
		for i := range eleft {
			if eleft[i] == u {
@@ -399,9 +407,11 @@ func (n *Node) Diff(node lib.Node, prefix string) (r []string, e error) {
		}
	}
	for _, u := range eleft {
		r = append(r, lib.URLPush(prefix, u))
		r = append(r, fmt.Sprintf("%s%s", prefix, u))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants