systemdPathBusEscape sanitizes a constituent string of a dbus ObjectPath using the rules that systemd uses for serializing special characters.
(path string)
| 973 | // systemdPathBusEscape sanitizes a constituent string of a dbus ObjectPath using the |
| 974 | // rules that systemd uses for serializing special characters. |
| 975 | func systemdPathBusEscape(path string) string { |
| 976 | // Special case the empty string |
| 977 | if len(path) == 0 { |
| 978 | return "_" |
| 979 | } |
| 980 | n := []byte{} |
| 981 | for i := 0; i < len(path); i++ { |
| 982 | c := path[i] |
| 983 | if systemdNeedsEscape(i, c) { |
| 984 | e := fmt.Sprintf("_%x", c) |
| 985 | n = append(n, []byte(e)...) |
| 986 | } else { |
| 987 | n = append(n, c) |
| 988 | } |
| 989 | } |
| 990 | return string(n) |
| 991 | } |
| 992 | |
| 993 | func (err *promptForDownloadError) Error() string { |
| 994 | innerErr := err.Unwrap() |
no test coverage detected
searching dependent graphs…