Clean Escape Code #499

Open
opened 2021-03-09 16:09:38 +00:00 by 6543 · 0 comments
Owner

"the answer is to create a function like fmt.Printf(...) that does the escaping itself.
escape.Printf("%-s/path/to/%s/%s/commit/%+s", baseUrl, user, repo, pathparts)
The %-s does not escape %s is escaped %+s is path segment escaped
and/or using type as your friend baseUrl is an type urlString string which escape.Printf will print plain but strings get escaped."

credits: @zeripath

"the answer is to create a function like fmt.Printf(...) that does the escaping itself. `escape.Printf("%-s/path/to/%s/%s/commit/%+s", baseUrl, user, repo, pathparts)` The `%-s` does not escape `%s` is escaped `%+s` is path segment escaped and/or using type as your friend `baseUrl` is an `type urlString string` which `escape.Printf` will print plain but strings get escaped." credits: @zeripath
6543 added the
kind/refactor
label 2021-03-09 16:09:38 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/go-sdk#499
No description provided.