Skip to content

Commit

Permalink
Add .toString() to fix filepath issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Schwartz-Matthew-bah committed Nov 29, 2018
1 parent be69071 commit ab43d95
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,19 @@ public void processAndBackupFile(Path filePath, Path backupDir, Path failureDir)
try {
inputStream = new FileInputStream(filePath.toFile());
String probeContentType = Files.probeContentType(filePath);
if (probeContentType != null && gZipPattern.matcher(probeContentType).matches() || filePath.endsWith("gz")) {
if ((probeContentType != null && gZipPattern.matcher(probeContentType).matches()) || filePath.toString().toLowerCase().endsWith("gz")) {
logger.info("Treating as gzip file");
inputStream = new GZIPInputStream(inputStream);
bis = publishFile(filePath, inputStream);
} else if (probeContentType != null && zipPattern.matcher(probeContentType).matches() || filePath.endsWith("zip")) {
} else if ((probeContentType != null && zipPattern.matcher(probeContentType).matches()) || filePath.toString().endsWith("zip")) {
logger.info("Treating as zip file");
inputStream = new ZipInputStream(inputStream);
ZipInputStream zis = (ZipInputStream)inputStream;
while (zis.getNextEntry() != null) {
bis = publishFile(filePath, inputStream);
}
} else {
logger.info("Treating as unknown file");
bis = publishFile(filePath, inputStream);
}
} catch (Exception e) {
Expand Down

0 comments on commit ab43d95

Please sign in to comment.