Index: /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageMetadata.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageMetadata.java	(revision 19248)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageMetadata.java	(revision 19249)
@@ -7,4 +7,5 @@
 import java.io.UncheckedIOException;
 import java.net.URI;
+import java.nio.file.FileSystemNotFoundException;
 import java.time.Instant;
 import java.util.List;
@@ -262,5 +263,5 @@
     /**
      * Extract GPS metadata from image EXIF. Has no effect if the image file is not set
-     *
+     * <p>
      * If successful, fills in the LatLon, speed, elevation, image direction, and other attributes
      * @since 18592 (interface), 9270 (GpxImageEntry)
@@ -272,4 +273,6 @@
         } catch (IOException e) {
             throw new UncheckedIOException(e);
+        } catch (IllegalArgumentException | FileSystemNotFoundException e) {
+            throw new UncheckedIOException(new IOException(e));
         }
     }
Index: /trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarkerTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarkerTest.java	(revision 19248)
+++ /trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarkerTest.java	(revision 19249)
@@ -7,4 +7,6 @@
 import java.io.File;
 import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
 
 import org.junit.jupiter.api.AfterEach;
@@ -17,4 +19,5 @@
 import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
 import org.openstreetmap.josm.testutils.annotations.Main;
+import org.openstreetmap.josm.tools.PlatformManager;
 
 /**
@@ -60,3 +63,22 @@
         assertDoesNotThrow(() -> marker.actionPerformed(null));
     }
+
+    /**
+     * Windows does not like {@code :} to appear multiple times in a path.
+     * @throws MalformedURLException if the URI fails to create and convert to a URL.
+     */
+    @Test
+    void testNonRegression23978() throws MalformedURLException {
+        final URL testURL;
+        if (PlatformManager.isPlatformWindows()) {
+            // This throws the InvalidPathException (subclass of IllegalArgumentException), and is what the initial problem was.
+            testURL = URI.create("file:/c:/foo/c:/bar/image.jpg").toURL();
+        } else {
+            // This throws an IllegalArgumentException.
+            testURL = new URL("file:/foobar/image.jpg#hashtagForIAE");
+        }
+        ImageMarker imageMarker = new ImageMarker(LatLon.ZERO, testURL,
+                new MarkerLayer(new GpxData(), null, null, null), 0, 0);
+        assertDoesNotThrow(() -> imageMarker.actionPerformed(null));
+    }
 }
