Changeset 3b34581 for apps


Ignore:
Timestamp:
Jun 30, 2018 2:06:52 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
201ef3b
Parents:
d4dd0ea
Message:

Console: Fix reading flags when symlinked (ticket #2270)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/jsp/flags.jsp

    rd4dd0ea r3b34581  
    2929        flagSet = "flags48x48";
    3030    }
    31     java.io.OutputStream cout = response.getOutputStream();
    3231    String base = net.i2p.I2PAppContext.getGlobalContext().getBaseDir().getAbsolutePath() +
    3332                  java.io.File.separatorChar +
     
    5958    response.setContentType("image/png");
    6059    response.setHeader("Accept-Ranges", "none");
     60    java.io.FileInputStream fin = null;
     61    java.io.OutputStream cout = response.getOutputStream();
    6162    try {
    62         net.i2p.util.FileUtil.readFile(file, base, cout);
     63        // flags dir may be a symlink, which readFile will reject
     64        // We carefully vetted the "c" value above.
     65        //net.i2p.util.FileUtil.readFile(file, base, cout);
     66        fin = new java.io.FileInputStream(ffile);
     67        net.i2p.data.DataHelper.copy(fin, cout);
    6368    } catch (java.io.IOException ioe) {
    6469        // prevent 'Committed' IllegalStateException from Jetty
     
    7176            throw ioe;
    7277        }
     78    } finally {
     79        if (fin != null)
     80            try { fin.close(); } catch (java.io.IOException ioe) {}
    7381    }
    7482} else {
Note: See TracChangeset for help on using the changeset viewer.