From 28be902870eedd23e6857c5fe7937b069e8b0eec Mon Sep 17 00:00:00 2001 From: Gavin Nishizawa Date: Fri, 9 Jun 2023 14:07:24 -0700 Subject: [PATCH] don't consider tooltip value a valid url if host is empty --- d2compiler/compile.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/d2compiler/compile.go b/d2compiler/compile.go index 4718636c5..0825166d6 100644 --- a/d2compiler/compile.go +++ b/d2compiler/compile.go @@ -533,8 +533,8 @@ func (c *compiler) compileReserved(attrs *d2graph.Attributes, f *d2ir.Field) { } if attrs.Link != nil && attrs.Tooltip != nil { - _, err := url.ParseRequestURI(attrs.Tooltip.Value) - if err == nil { + u, err := url.ParseRequestURI(attrs.Tooltip.Value) + if err == nil && u.Host != "" { c.errorf(scalar, "Tooltip cannot be set to URL when link is also set (for security)") } }