-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misc fixes #560
base: main
Are you sure you want to change the base?
Misc fixes #560
Changes from 1 commit
9498f39
8b0a8e6
6dd81b1
3e03f07
ef35ac7
9518366
87964bb
186f1c9
c518070
cc20a34
f81662d
682b41f
edd19b2
ca68585
fadeb9a
8515e0b
a6b6598
6fc49c2
dc277e9
1f3380e
a31465b
0c957d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,25 +2,15 @@ package _routers | |
|
||
import ( | ||
"context" | ||
"errors" | ||
"net/http" | ||
"regexp" | ||
|
||
"github.com/julienschmidt/httprouter" | ||
) | ||
|
||
func localCompile(expr string) *regexp.Regexp { | ||
r, err := regexp.Compile(expr) | ||
if err != nil { | ||
panic(errors.New("error compiling expression: " + expr + " | " + err.Error())) | ||
} | ||
return r | ||
} | ||
|
||
var ServerNameRegex = localCompile("[a-zA-Z0-9.:\\-_]+") | ||
|
||
//var NumericIdRegex = localCompile("[0-9]+") | ||
var ServerNameRegex = regexp.MustCompile("[a-zA-Z0-9.:\\-_]+") | ||
|
||
// var NumericIdRegex = regexp.MustCompile("[0-9]+") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like this got moved down incorrectly |
||
func GetParam(name string, r *http.Request) string { | ||
p := httprouter.ParamsFromContext(r.Context()) | ||
if p == nil { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please revert 8515e0b - the package naming is deliberate |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please revert fadeb9a - the package naming is deliberate |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please revert 87964bb - this is not a change I'm looking to support at the moment, for reasons discussed over chat. Primarily, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions deliberately do not take error objects to avoid accidentally leaking internal details to callers - please revert this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's an exception to this rule later on in the federation test/info endpoints, as those endpoints are primarily used for debugging or by admins rather than random consumers.