don't consider tooltip value a valid url if host is empty

This commit is contained in:
Gavin Nishizawa 2023-06-09 14:07:24 -07:00
parent 405f1c9777
commit 28be902870
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD

View file

@ -533,8 +533,8 @@ func (c *compiler) compileReserved(attrs *d2graph.Attributes, f *d2ir.Field) {
} }
if attrs.Link != nil && attrs.Tooltip != nil { if attrs.Link != nil && attrs.Tooltip != nil {
_, err := url.ParseRequestURI(attrs.Tooltip.Value) u, err := url.ParseRequestURI(attrs.Tooltip.Value)
if err == nil { if err == nil && u.Host != "" {
c.errorf(scalar, "Tooltip cannot be set to URL when link is also set (for security)") c.errorf(scalar, "Tooltip cannot be set to URL when link is also set (for security)")
} }
} }