File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 3
3
import static io .quarkus .deployment .annotations .ExecutionTime .RUNTIME_INIT ;
4
4
5
5
import java .nio .file .Files ;
6
+ import java .nio .file .Path ;
6
7
import java .util .ArrayList ;
7
8
import java .util .HashSet ;
8
9
import java .util .List ;
@@ -107,11 +108,17 @@ public void nativeImageResource(Optional<StaticResourcesBuildItem> staticResourc
107
108
*/
108
109
private Set <StaticResourcesBuildItem .Entry > getClasspathResources () {
109
110
Set <StaticResourcesBuildItem .Entry > knownPaths = new HashSet <>();
111
+ final String prefix = StaticResourcesRecorder .META_INF_RESOURCES ;
110
112
visitRuntimeMetaInfResources (visit -> {
111
- if (!Files .isDirectory (visit .getPath ())) {
112
- knownPaths .add (new StaticResourcesBuildItem .Entry (
113
- visit .getRelativePath ().substring (StaticResourcesRecorder .META_INF_RESOURCES .length ()),
114
- false ));
113
+ Path visitPath = visit .getPath ();
114
+ if (!Files .isDirectory (visitPath )) {
115
+ String rel = visit .getRelativePath ();
116
+ // Ensure that the relative path starts with the prefix before calling substring
117
+ if (rel .startsWith (prefix )) {
118
+ // Strip the "META-INF/resources/" prefix and add the remainder
119
+ String subPath = rel .substring (prefix .length ());
120
+ knownPaths .add (new StaticResourcesBuildItem .Entry (subPath , false ));
121
+ }
115
122
}
116
123
});
117
124
return knownPaths ;
You can’t perform that action at this time.
0 commit comments