Index: src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 6117)
+++ src/org/openstreetmap/josm/tools/ImageProvider.java	(working copy)
@@ -29,6 +29,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ExecutorService;
@@ -525,7 +526,31 @@
         try
         {
             zipFile = new ZipFile(archive);
-            ZipEntry entry = zipFile.getEntry(full_name);
+
+            ZipEntry entry = null;
+            entry = zipFile.getEntry(full_name);
+
+            // Issue #8686: Allow ZIP files whose paths are relative to the ZIP root in JOSM's map styling
+            if (entry == null) {
+            	// Find the mapcss file to use as the path root
+                Enumeration<? extends ZipEntry> entries = zipFile.entries();
+                String mapCssPath = "";
+                ZipEntry testEntry;
+                while (entries.hasMoreElements()) {
+                    testEntry = entries.nextElement();
+                    if (testEntry.getName().endsWith(".mapcss")) {
+                    	mapCssPath = testEntry.getName();
+                        break;
+                    }
+                }
+                String zipPathPrefix = mapCssPath.substring(0, mapCssPath.lastIndexOf("/"));
+                if (zipPathPrefix.length() > 0) {
+                	zipPathPrefix += "/";
+                }
+                entry = zipFile.getEntry(zipPathPrefix + full_name); 
+            }
+            ///
+
             if(entry != null)
             {
                 int size = (int)entry.getSize();
