solomax commented on a change in pull request #166:
URL: https://github.com/apache/openmeetings/pull/166#discussion_r732016487



##########
File path: 
openmeetings-util/src/main/java/org/apache/openmeetings/util/OpenmeetingsVariables.java
##########
@@ -249,11 +256,12 @@ public static String getBaseUrl() {
        }
 
        public static String getWebappPath() {
-               String webappPath = baseUrl;
-               if (webappPath.endsWith("/")) {
-                       webappPath = webappPath.substring(0, 
webappPath.length() - 1);
+               try {

Review comment:
       Sorry for the late response
   Tuesday is a bit crazy day :(((
   
   I've just played with `URI`s in `jshell`
   and here is what I propose :)))
   
   This method can be rewritten as
   ```
   private static URI getWebappPath(url) {
       return URI.create(new URI(url + "/").normalize().getPath());
   }
   
   public static URI getWebappPath() {
       try {
           return getWebappPath(url);
       } catch (URISyntaxException e) {
           return getWebappPath(DEFAULT_BASE_URL);
       }
   }
   ```
   
   this way the `URI` returned will always have trailing '/'
   
   UPDATE: `try-catch` added back, just in-case :)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to