File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -5,15 +5,19 @@ if [ -z "$REINDEX" ]; then
5
5
REINDEX=10
6
6
fi
7
7
8
- if [[ -z " ${OPENGROK_WEBAPP_CONTEXT} " || " ${OPENGROK_WEBAPP_CONTEXT} " = * " " * ]]; then
9
- date +" %F %T Deployment path is empty or contains spaces. Deploying to root..."
8
+ if [[ " ${OPENGROK_WEBAPP_CONTEXT} " = * " " * ]]; then
9
+ date +" %F %T Deployment path contains spaces. Deploying to root..."
10
10
export OPENGROK_WEBAPP_CONTEXT=" /"
11
11
fi
12
12
13
- if [ " ${OPENGROK_WEBAPP_CONTEXT} " = " /" ]; then
13
+ # Remove leading and trailing slashes
14
+ OPENGROK_WEBAPP_CONTEXT=" ${OPENGROK_WEBAPP_CONTEXT#/ } "
15
+ OPENGROK_WEBAPP_CONTEXT=" ${OPENGROK_WEBAPP_CONTEXT%/ } "
16
+
17
+ if [ " ${OPENGROK_WEBAPP_CONTEXT} " = " " ]; then
14
18
WAR_NAME=" ROOT.war"
15
19
else
16
- WAR_NAME=" ${OPENGROK_WEBAPP_CONTEXT#/ } .war"
20
+ WAR_NAME=" ${OPENGROK_WEBAPP_CONTEXT// \/ /# } .war"
17
21
fi
18
22
19
23
if [ ! -f " /usr/local/tomcat/webapps/${WAR_NAME} " ]; then
@@ -26,7 +30,7 @@ if [ ! -f "/usr/local/tomcat/webapps/${WAR_NAME}" ]; then
26
30
27
31
# Set up redirect from /source
28
32
mkdir " /usr/local/tomcat/webapps/source"
29
- echo " <% response.sendRedirect(\" ${OPENGROK_WEBAPP_CONTEXT} \" ); %>" > " /usr/local/tomcat/webapps/source/index.jsp"
33
+ echo " <% response.sendRedirect(\" / ${OPENGROK_WEBAPP_CONTEXT} \" ); %>" > " /usr/local/tomcat/webapps/source/index.jsp"
30
34
fi
31
35
32
36
indexer (){
You can’t perform that action at this time.
0 commit comments