@@ -14,6 +14,7 @@ import (
14
14
// StaticContentHandler it's a provider static content cloned from repository
15
15
func StaticContentHandler (w http.ResponseWriter , r * http.Request ) {
16
16
repoConfig := utils .GetRepositoryConfigInstance ()
17
+
17
18
keys , ok := r .URL .Query ()["_branch" ]
18
19
19
20
branch := repoConfig .GetBranch ()
@@ -25,6 +26,15 @@ func StaticContentHandler(w http.ResponseWriter, r *http.Request) {
25
26
}
26
27
27
28
basePath := utils .BuildBranchPath (repoConfig .GetTargetFolder (), branch )
29
+
30
+ if repoConfig .GetRootFolder () != "" {
31
+ basePath = fmt .Sprintf ("%s/%s" , basePath , repoConfig .GetRootFolder ())
32
+
33
+ if strings .Contains (basePath , "//" ) {
34
+ basePath = strings .ReplaceAll (basePath , "//" , "/" )
35
+ }
36
+ }
37
+
28
38
log .Printf ("[Request] Path %s" , basePath )
29
39
30
40
fs := http .FileServer (http .Dir (basePath ))
@@ -66,6 +76,15 @@ func PullHandler(w http.ResponseWriter, r *http.Request) {
66
76
fmt .Fprintf (w , "Last commit [%s]" , commit .ToString ())
67
77
}
68
78
79
+ // FeatureNotEnabled it's a handler to response feature not enabled
80
+ func FeatureNotEnabled (w http.ResponseWriter , r * http.Request ) {
81
+
82
+ w .WriteHeader (http .StatusNotAcceptable )
83
+
84
+ fmt .Fprintf (w , "Operation %s not supported with present configuration \n " , r .URL )
85
+
86
+ }
87
+
69
88
// HealthCheckHandler it's a handler to return server status
70
89
func HealthCheckHandler (w http.ResponseWriter , r * http.Request ) {
71
90
healthCheck := utils .GetHealthCheckControlInstance ()
0 commit comments