From e346a43b76573e1c3baa09988ff67e9ab4047170 Mon Sep 17 00:00:00 2001 From: Al Niessner Date: Tue, 4 Jun 2024 15:37:29 -0700 Subject: [PATCH] fix local file manipulation --- src/main/java/gov/nasa/pds/tools/util/ImageUtil.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/gov/nasa/pds/tools/util/ImageUtil.java b/src/main/java/gov/nasa/pds/tools/util/ImageUtil.java index ec27e9f8b..24608409c 100644 --- a/src/main/java/gov/nasa/pds/tools/util/ImageUtil.java +++ b/src/main/java/gov/nasa/pds/tools/util/ImageUtil.java @@ -79,13 +79,10 @@ public boolean isJPEG(String jpegBase, URL parentURL) throws Exception { // File(uri.getPath()).getParent()" which will only get the top level directory. // It would be a bug if the file is in a sub directory of the top level // directory. - String parent = parentURL.getFile(); - - LOG.debug("isJPEG:,parent,jpegBase {},{}", parent, jpegBase); - + + // try using Paths and URI internal consistency to make this work for #902 // Build the full pathname of the file. - String jpegRef = Paths.get(parent, jpegBase).toString(); - LOG.debug("isJPEG:parent,jpegBase,jpegRef [{}],[{}],[{}]", parent, jpegBase, jpegRef); + String jpegRef = Paths.get(parentURL.toURI().resolve(jpegBase)).toString(); File jpegFile = new File(jpegRef); RandomAccessFile raf = new RandomAccessFile(jpegFile, "r");