enonic / lib-static

Library for serving static assets through XP, optimized for client caching
Apache License 2.0
0 stars 0 forks source link

`.exists()` returns true for directories in XP prod runmode #63

Closed espen42 closed 3 years ago

espen42 commented 3 years ago

In XP prod run mode, .exists() returns true for files as it should, but also for directories whose name don't end with a slash - as it shouldn't. This keeps the redirect/index fallback feature from working in prod mode.

Likely cause: in IoService in dev mode, url.getProtocol() returns "file" for both directories and files. Then, Files.isDirectory( Path.of( url.toURI()) can be used to determine if a url points to a directory, and return false.

In prod mode however, url.getProtocol() returns "bundle" for both files and directories, and this causes .exists() to return true in both cases.

espen42 commented 3 years ago

This seems to be a bug in the fix #58 .

rymsha commented 3 years ago

This is due to this bug https://issues.apache.org/jira/browse/FELIX-6294

rymsha commented 3 years ago

issue in XP https://github.com/enonic/xp/issues/8753