MCPcopy Index your code
hub / github.com/TruthHun/BookStack / DealUri

Function DealUri

utils/pager.go:133–163  ·  view source on GitHub ↗

** * 处理url,目的是保存参数 */

(po *PageOptions, requestURI string)

Source from the content-addressed store, hash-verified

131 * 处理url,目的是保存参数
132 */
133func DealUri(po *PageOptions, requestURI string) {
134 var rs string
135 if strings.Contains(requestURI, "?") {
136 arr := strings.Split(requestURI, "?")
137 rs = ""
138 arr2 := strings.Split(arr[1], "&")
139 for _, v := range arr2 {
140 if !strings.Contains(v, po.ParamName) {
141 if strings.HasSuffix(rs, "&") {
142 rs += v
143 } else {
144 rs += v + "&"
145 }
146 //rs += "&" + v
147 }
148 }
149 if strings.HasPrefix(rs, "&") {
150 rs = string(rs[1:])
151 }
152 if strings.HasSuffix(rs, "&") {
153 rs = string(rs[0 : strings.Count(rs, "")-1])
154 }
155 rs = arr[0] + "?" + rs
156 fmt.Println(rs)
157 } else {
158 //rs = requestURI + "?" //+ po.ParamName + "time=" + con.Itoa(time.Now().Second())
159 rs = requestURI + "?"
160 }
161
162 po.Href = rs
163}
164
165/**
166 * 1...197 198 199 200

Callers 2

GetPagerLinksFunction · 0.85
GetPagerHtmlFunction · 0.85

Calls 2

stringFunction · 0.85
CountMethod · 0.45

Tested by

no test coverage detected