Index: trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarkerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarkerTest.java	(revision 19247)
+++ 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));
+    }
 }
