EncodePathSegment percent-encodes user input for safe use as a single URL path segment (e.g. / → %2F, ? → %3F, # → %23), ensuring the value cannot alter the URL routing structure when interpolated into an API path. This provides defense-in-depth alongside ResourceName: ResourceName rejects known da
(s string)
| 58 | // Convention: all user-provided variables in fmt.Sprintf API paths within shortcuts/ |
| 59 | // MUST be wrapped with this function. |
| 60 | func EncodePathSegment(s string) string { |
| 61 | return url.PathEscape(s) |
| 62 | } |
no outgoing calls