Pārlūkot izejas kodu

fixed loadResource if url is a directory

Nicolas Cannasse 5 mēneši atpakaļ
vecāks
revīzija
9f8801cf6e
1 mainītis faili ar 7 papildinājumiem un 1 dzēšanām
  1. 7 1
      h2d/domkit/BaseComponents.hx

+ 7 - 1
h2d/domkit/BaseComponents.hx

@@ -69,7 +69,13 @@ class CustomParser extends domkit.CssValue.ValueParser {
 		// TODO : compile-time path check?
 		return true;
 		#else
-		return try hxd.res.Loader.currentInstance.load(path) catch( e : hxd.res.NotFound ) invalidProp("Resource not found "+path);
+		return try {
+			var f = hxd.res.Loader.currentInstance.load(path);
+			if( f.entry.isDirectory ) invalidProp("Resource should be a file "+path);
+			return f;
+		} catch( e : hxd.res.NotFound ) {
+			invalidProp("Resource not found "+path);
+		}
 		#end
 	}