aboutsummaryrefslogtreecommitdiff
path: root/pathrouter/utils.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2026-06-27 22:34:36 +0200
committerStefan Majewsky <majewsky@gmx.net>2026-06-27 22:34:36 +0200
commit8e9889d3e5b2874854832d1d882d124132546f49 (patch)
tree80ab6bf53dac3090630ad58d7ebfbbf2c97019ca /pathrouter/utils.go
parent8804729561d8e5edd7179f494d89c620459d319f (diff)
downloadgo-gg-8e9889d3e5b2874854832d1d882d124132546f49.tar.gz
add package pathrouter
Diffstat (limited to 'pathrouter/utils.go')
-rw-r--r--pathrouter/utils.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/pathrouter/utils.go b/pathrouter/utils.go
new file mode 100644
index 0000000..e8704a7
--- /dev/null
+++ b/pathrouter/utils.go
@@ -0,0 +1,22 @@
+// SPDX-FileCopyrightText: 2026 Stefan Majewsky <majewsky@gmx.net>
+// SPDX-License-Identifier: Apache-2.0
+
+package pathrouter
+
+import (
+ "fmt"
+ "net/url"
+)
+
+func pathUnescape(in string) string {
+ out, err := url.PathUnescape(in)
+ if err != nil {
+ // defense in depth: should not fail because `in` was indirectly obtained from r.URL.EscapedPath()
+ panic(fmt.Sprintf("PathUnescape failed on %q: %s", in, err.Error()))
+ }
+ return out
+}
+
+func increment(x int) int {
+ return x + 1
+}