Skip to content

Commit

Permalink
Create EscapeSingleQuote in utils
Browse files Browse the repository at this point in the history
  • Loading branch information
daramir committed Nov 4, 2021
1 parent b1136c3 commit 1b2b0fc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/utils/odata_query_string.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package utils

import "strings"

// EscapeSingleQuote replaces all occurrences of single quote, with 2 single quotes.
// For requests that use single quotes, if any parameter values also contain single quotes,
// those must be double escaped; otherwise, the request will fail due to invalid syntax.
// https://docs.microsoft.com/en-us/graph/query-parameters#escaping-single-quotes
func EscapeSingleQuote(qparam string) string {
return strings.ReplaceAll(qparam, `'`, `''`)
}

0 comments on commit 1b2b0fc

Please sign in to comment.