Skip to content

Commit

Permalink
wrappers: update error message for non-canonicalized icon path
Browse files Browse the repository at this point in the history
  • Loading branch information
jhenstridge committed Sep 17, 2019
1 parent 6918530 commit d22b27a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion wrappers/desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
5 changes: 4 additions & 1 deletion wrappers/desktop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d22b27a

Please sign in to comment.