solomax commented on a change in pull request #166:
URL: https://github.com/apache/openmeetings/pull/166#discussion_r732439198
##########
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:
My code was sort-of "pseudo code"
I wrote it without compiler :))
it should look as follows:
```
private static URI getWebappPath(url) throws URISyntaxException {
return new URI(new URI(url + "/").normalize().getPath());
}
public static URI getWebappPath() {
try {
return getWebappPath(baseUrl);
} catch (URISyntaxException e) {
return getWebappPath(DEFAULT_BASE_URL);
}
}
```
The idea is `new URI` can `throw URISyntaxException` while parsing
While subsequent `URI.create` should be safe
I dropped `URI.create` to be 100% bulletproof
now we do same actions on current `baseUrl` OR `DEFAULT_BASE_URL` in case of
error
your current code will return `https://localhost:5443/openmeetings`
which is not intended ....
--
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]