diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportBranding.java b/Core/src/org/sleuthkit/autopsy/report/ReportBranding.java index a19b2102f0..e8759358e7 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportBranding.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportBranding.java @@ -79,26 +79,21 @@ public final class ReportBranding implements ReportBrandingProviderI { @Override public String getGeneratorLogoPath() { String curPath = null; -// try { -// curPath = ModuleSettings.getConfigSetting(MODULE_NAME, GENERATOR_LOGO_PATH_PROP); -// if (curPath == null || curPath.isEmpty() || new File(curPath).canRead() == false) { -// //use default -// logger.log(Level.INFO, "Using default report branding for generator logo"); -// curPath = reportsBrandingDir + File.separator + "logo.png"; -// InputStream in = getClass().getResourceAsStream(DEFAULT_GENERATOR_LOGO); -// OutputStream output = new FileOutputStream(new File(curPath)); -// FileUtil.copy(in, output); -// ModuleSettings.setConfigSetting(MODULE_NAME, GENERATOR_LOGO_PATH_PROP, curPath); -// } -// } catch (IOException e) { -// logger.log(Level.SEVERE, "Error extracting report branding resources for generator logo", e); -// } - curPath = ModuleSettings.getConfigSetting(MODULE_NAME, GENERATOR_LOGO_PATH_PROP); - if (curPath != null && new File(curPath).canRead() == false) { - //use default - logger.log(Level.INFO, "Custom report branding for generator logo is not valid: " + curPath); - curPath = null; + try { + curPath = ModuleSettings.getConfigSetting(MODULE_NAME, GENERATOR_LOGO_PATH_PROP); + if (curPath == null || (!curPath.isEmpty() && !new File(curPath).canRead() ) ) { + //use default + logger.log(Level.INFO, "Using default report branding for generator logo"); + curPath = reportsBrandingDir + File.separator + "logo.png"; + InputStream in = getClass().getResourceAsStream(DEFAULT_GENERATOR_LOGO); + OutputStream output = new FileOutputStream(new File(curPath)); + FileUtil.copy(in, output); + ModuleSettings.setConfigSetting(MODULE_NAME, GENERATOR_LOGO_PATH_PROP, curPath); + } + } catch (IOException e) { + logger.log(Level.SEVERE, "Error extracting report branding resources for generator logo", e); } + return curPath; } diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportBrandingProviderI.java b/Core/src/org/sleuthkit/autopsy/report/ReportBrandingProviderI.java index 8368682317..f7814f001c 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportBrandingProviderI.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportBrandingProviderI.java @@ -35,7 +35,7 @@ public interface ReportBrandingProviderI { /** * Sets custom generator logo path * - * @param path path to set + * @param path path to set, use empty string to disable */ public void setGeneratorLogoPath(String path); @@ -51,7 +51,7 @@ public interface ReportBrandingProviderI { /** * Sets custom agency logo path * - * @param path path to set + * @param path path to set, use empty string to disable */ public void setAgencyLogoPath(String path); diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java b/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java index b44b32c007..d3d16d109c 100644 --- a/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java @@ -459,14 +459,14 @@ public class ReportHTML implements TableReportModule { //pull generator and agency logo from branding, and the remaining resources from the core jar String generatorLogoPath = reportBranding.getGeneratorLogoPath(); - if (generatorLogoPath != null) { + if (generatorLogoPath != null && ! generatorLogoPath.isEmpty()) { File from = new File(generatorLogoPath); File to = new File(path); FileUtil.copyFile(FileUtil.toFileObject(from), FileUtil.toFileObject(to), "generator_logo"); } String agencyLogoPath = reportBranding.getAgencyLogoPath(); - if (agencyLogoPath != null) { + if (agencyLogoPath != null && ! agencyLogoPath.isEmpty() ) { File from = new File(agencyLogoPath); File to = new File(path); FileUtil.copyFile(FileUtil.toFileObject(from), FileUtil.toFileObject(to), "agency_logo"); @@ -624,8 +624,8 @@ public class ReportHTML implements TableReportModule { final String reportTitle = reportBranding.getReportTitle(); final String reportFooter = reportBranding.getReportFooter(); - final boolean agencyLogoSet = reportBranding.getAgencyLogoPath() != null; - final boolean generatorLogoSet = reportBranding.getGeneratorLogoPath() != null; + final boolean agencyLogoSet = reportBranding.getAgencyLogoPath() != null && !reportBranding.getAgencyLogoPath().isEmpty(); + final boolean generatorLogoSet = reportBranding.getGeneratorLogoPath() != null && !reportBranding.getGeneratorLogoPath().isEmpty(); summary.append("
\n"); summary.append("

").append(reportTitle).append(running ? "Warning, this report was run before ingest services completed!" : "").append("

\n");