mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-12-20 05:25:36 +00:00
Add basic extraction methods
This commit is contained in:
@@ -56,6 +56,13 @@ func GetPath(resource string, slug string) (string, error) {
|
||||
return ret.Path, nil
|
||||
}
|
||||
|
||||
func SanitizePath(path string) error {
|
||||
if strings.Contains(path, "/") || strings.Contains(path, "..") {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "Invalid parameter. Can't contains path delimiters or ..")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetClientId(c echo.Context) (string, error) {
|
||||
key := c.Request().Header.Get("X-CLIENT-ID")
|
||||
if key == "" {
|
||||
|
||||
Reference in New Issue
Block a user