diff --git a/wrappers/desktop.go b/wrappers/desktop.go index 561899484f9..26137335f1d 100644 --- a/wrappers/desktop.go +++ b/wrappers/desktop.go @@ -151,7 +151,7 @@ func rewriteIconLine(s *snap.Info, line string) (string, error) { return "", fmt.Errorf("icon path %q is not part of the snap", icon) } if filepath.Clean(icon) != icon { - return "", fmt.Errorf("icon path %q is not canonicalized", icon) + return "", fmt.Errorf("icon path %q is not canonicalized, did you mean %q?", icon, filepath.Clean(icon)) } return line, nil } diff --git a/wrappers/desktop_test.go b/wrappers/desktop_test.go index 83467d4f319..6ed7a6a25a4 100644 --- a/wrappers/desktop_test.go +++ b/wrappers/desktop_test.go @@ -512,8 +512,11 @@ version: 1.0 _, err = wrappers.RewriteIconLine(snap, "Icon=/etc/passwd") c.Check(err, ErrorMatches, `icon path "/etc/passwd" is not part of the snap`) + _, err = wrappers.RewriteIconLine(snap, "Icon=${SNAP}/./icon.png") + c.Check(err, ErrorMatches, `icon path "\${SNAP}/./icon.png" is not canonicalized, did you mean "\${SNAP}/icon.png"\?`) + _, err = wrappers.RewriteIconLine(snap, "Icon=${SNAP}/../outside/icon.png") - c.Check(err, ErrorMatches, `icon path "\${SNAP}/../outside/icon.png" is not canonicalized`) + c.Check(err, ErrorMatches, `icon path "\${SNAP}/../outside/icon.png" is not canonicalized, did you mean "outside/icon.png"\?`) } func (s *sanitizeDesktopFileSuite) TestSanitizeParallelInstancesIconName(c *C) {