blob: 5395b92a4612f2b075d75c04ddbb4d0efd92c76f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// SPDX-License-Identifier: AGPL-3.0-only
// SPDX-FileContributor: Runxi Yu <https://runxiyu.org>
package main
import (
"net/url"
"path"
"strings"
)
func firstLine(s string) string {
before, _, _ := strings.Cut(s, "\n")
return before
}
func baseName(s string) string {
return path.Base(s)
}
func pathEscape(s string) string {
return url.PathEscape(s)
}
func queryEscape(s string) string {
return url.QueryEscape(s)
}
func dereference[T any](p *T) T {
return *p
}
|