https://bz.apache.org/bugzilla/show_bug.cgi?id=69142

--- Comment #4 from Christopher Schultz <ch...@christopherschultz.net> ---
We could keep track of both the "appended" string as well as the trimmed
string. That is, in the case where the path does not end in a "/" we could keep
the "naked" path and re-use it later instead of adding, then trimming.

The rest of the logic could remain the same.

For example:

if (path.charAt(path.length() - 1) != '/')
    String withTrailingSlash = path + "/";

    if (webAppMount.startsWith(withTrailingSlash)) {
        String name = path; // Without trailing slash
        name = name.substring(name.lastIndexOf('/') + 1);
        if (name.length() > 0) {
            return new VirtualResource(root, path, name);
        }
    } else {
        path = withTrailingSlash;
    }
else if (webAppMount.startsWith(path)) {
    String name = path.substring(0, path.length() - 1);
    name = name.substring(name.lastIndexOf('/') + 1);
    if (name.length() > 0) {
        return new VirtualResource(root, path, name);
    }
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to