changed way to detemine organization

This commit is contained in:
ebner 2025-03-03 12:45:15 +01:00
parent 1418f0e14e
commit d98f8352bf

View File

@ -122,7 +122,7 @@ func (module GiteaPagesModule) ServeHTTP(writer http.ResponseWriter, request *ht
// The URL/path looks like http(s)://<organization>.<giteaserver>[:<port>]/<repository>/[/<filepath>] // The URL/path looks like http(s)://<organization>.<giteaserver>[:<port>]/<repository>/[/<filepath>]
// extract the organization from the hostname // extract the organization from the hostname
organization = strings.TrimRight(request.Host, ".") organization = strings.Split(request.Host, ".")[0]
// Remove a potential "/" prefix and trailing "/" - then split up the path // Remove a potential "/" prefix and trailing "/" - then split up the path
path = strings.TrimSuffix(strings.TrimPrefix(request.URL.Path, "/"), "/") path = strings.TrimSuffix(strings.TrimPrefix(request.URL.Path, "/"), "/")