This is an automated email from the ASF dual-hosted git repository. thiagohp pushed a commit to branch 5.9.x in repository https://gitbox.apache.org/repos/asf/tapestry-5.git
commit 3e5eab5990ee7f3e894da55c4402c71530141959 Author: Thiago H. de Paula Figueiredo <[email protected]> AuthorDate: Sun Mar 29 12:32:55 2026 -0300 Improving code. --- .../internal/services/assets/ClasspathAssetRequestHandler.java | 5 ++++- .../src/main/java/org/apache/tapestry5/modules/AssetsModule.java | 2 ++ .../org/apache/tapestry5/services/ClasspathAssetProtectionRule.java | 1 + tapestry-core/src/test/app1/AssetProtectionDemo.tml | 5 +++-- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/ClasspathAssetRequestHandler.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/ClasspathAssetRequestHandler.java index 2e745de8d..1391bcee0 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/ClasspathAssetRequestHandler.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/ClasspathAssetRequestHandler.java @@ -61,7 +61,10 @@ public class ClasspathAssetRequestHandler implements AssetRequestHandler ChecksumPath path = new ChecksumPath(streamer, baseFolder, extraPath); final boolean handled; - if (classpathAssetProtectionRule.block(path.resourcePath) && !path.resourcePath.equals(ChecksumPath.NON_EXISTING_RESOURCE)) + + final String resourcePath = path.resourcePath.replace("\\.", ""); + + if (classpathAssetProtectionRule.block(resourcePath) && !path.resourcePath.equals(ChecksumPath.NON_EXISTING_RESOURCE)) { if (LOGGER.isWarnEnabled()) { diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/modules/AssetsModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/modules/AssetsModule.java index 72091ddbe..e634285c8 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/modules/AssetsModule.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/modules/AssetsModule.java @@ -429,6 +429,8 @@ public class AssetsModule configuration.add("PropertiesFile", propertiesFileRule); ClasspathAssetProtectionRule xmlFileRule = (s) -> s.toLowerCase().endsWith(".xml"); configuration.add("XMLFile", xmlFileRule); + ClasspathAssetProtectionRule tmlFileRule = (s) -> s.toLowerCase().endsWith(".tml"); + configuration.add("TemplateFile", tmlFileRule); ClasspathAssetProtectionRule folderRule = (s) -> isFolderToBlock(s); configuration.add("Folder", folderRule); } diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/ClasspathAssetProtectionRule.java b/tapestry-core/src/main/java/org/apache/tapestry5/services/ClasspathAssetProtectionRule.java index 6f8af4408..84dab4b6c 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/services/ClasspathAssetProtectionRule.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/services/ClasspathAssetProtectionRule.java @@ -21,6 +21,7 @@ import org.apache.tapestry5.ioc.annotations.UsesOrderedConfiguration; * based on their paths. Access is blocked if any rule says it should be blocked. * * @see ComponentEventRequestHandler + * @since 5.5.0 */ @UsesOrderedConfiguration(ClasspathAssetProtectionRule.class) public interface ClasspathAssetProtectionRule diff --git a/tapestry-core/src/test/app1/AssetProtectionDemo.tml b/tapestry-core/src/test/app1/AssetProtectionDemo.tml index e21bc6173..3ef825541 100644 --- a/tapestry-core/src/test/app1/AssetProtectionDemo.tml +++ b/tapestry-core/src/test/app1/AssetProtectionDemo.tml @@ -14,9 +14,10 @@ <li><a href="${asset:context:META-INF}">META-INF</a></li> <li><a href="${asset:context:META-INF/}">META-INF/</a></li> <li><a href="${asset:context:META-INF/unavailable2.txt}">unavailable2.txt</a></li> - <li><a href="${asset:context:AssetProtectionDemo.tml}">tml file</a></li> - <li><a href="${asset:context:music/MusicDetails.tml}">nested tml file</a></li> + <li><a href="${asset:context:AssetProtectionDemo.tml}">context tml file</a></li> + <li><a href="${asset:context:music/MusicDetails.tml}">context nested tml file</a></li> <li><a href="/assets/app//services/AppModule.class">.class file in the classpath</a></li> + <li><a href="${asset:classpath:/org/apache/tapestry5/integration/app1/base/GenericEditor.tml}">.tml file in the classpath</a></li> <li><a href="${asset:classpath:/org/apache/tapestry5/integration/app1/fakeconfiguration.properties}">.properties file in the classpath</a></li> <li><a href="${asset:classpath:/org/apache/tapestry5/integration/app1/fakeconfiguration.xml}">.xml file in the classpath</a></li> </ul>
