Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1697#discussion_r53841086
  
    --- Diff: 
flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/files/StaticFileServerHandler.java
 ---
    @@ -196,16 +198,22 @@ public void channelRead0(ChannelHandlerContext ctx, 
Routed routed) throws Except
         * Response when running with leading JobManager.
         */
        private void respondAsLeader(ChannelHandlerContext ctx, HttpRequest 
request, String requestPath)
    -           throws IOException, ParseException {
    +                   throws IOException, ParseException, URISyntaxException {
     
                // convert to absolute path
                final File file = new File(rootPath, requestPath);
     
    -           if(!file.exists()) {
    +           if (!file.exists()) {
                        // file does not exist. Try to load it with the 
classloader
                        ClassLoader cl = 
StaticFileServerHandler.class.getClassLoader();
    +
                        try(InputStream resourceStream = 
cl.getResourceAsStream("web" + requestPath)) {
    -                           if (resourceStream == null) {
    +                           // Check that we don't load anything from 
outside of the
    +                           // expected resource.
    +                           URI root = cl.getResource("web").toURI();
    +                           URI req = cl.getResource("web" + 
requestPath).toURI();
    --- End diff --
    
    if the resources doesn't exist this will throw an NPE. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to