Browse Source

fixed loadResource if url is a directory

Nicolas Cannasse 5 months ago
parent
commit
9f8801cf6e
1 changed files with 7 additions and 1 deletions
  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?
 		// TODO : compile-time path check?
 		return true;
 		return true;
 		#else
 		#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
 		#end
 	}
 	}