This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git


The following commit(s) were added to refs/heads/master by this push:
     new 93583f018 Fix StringIndexOutOfBoundsException
93583f018 is described below

commit 93583f0180337caecda49ad6c7243fcd8eefba61
Author: Ulf Dittmer <34645700+uditt...@users.noreply.github.com>
AuthorDate: Thu Jun 19 09:40:56 2025 +0200

    Fix StringIndexOutOfBoundsException
    
    On Tomcat 9, this call causes an exception for "/ajax/users" and "users" 
(in the Users tab in Admin.jsp). I haven't checked other servlet containers.
    
    I'm not sure if this is the right fix, but it does make it work for me.
---
 jspwiki-main/src/main/java/org/apache/wiki/ajax/AjaxUtil.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/ajax/AjaxUtil.java 
b/jspwiki-main/src/main/java/org/apache/wiki/ajax/AjaxUtil.java
index 164492f0b..be42896df 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/ajax/AjaxUtil.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/ajax/AjaxUtil.java
@@ -62,6 +62,11 @@ public class AjaxUtil extends HttpServlet {
         if( StringUtils.isBlank( path ) ) {
                        return null;
                }
+               
+                // if this is true, there's nothing left to be done
+                if (path.endsWith(lastPart))
+                        return lastPart;
+
                if( !lastPart.endsWith( "/" ) ) {
                        lastPart += "/";
                }

Reply via email to