[ 
https://issues.apache.org/jira/browse/SLING-3829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14321549#comment-14321549
 ] 

Oliver Lietz commented on SLING-3829:
-------------------------------------

You can exclude by extension, no?
Your {{<from/>}} could look like this: {{(?!.+\.jpg)(/usergenerated/.)}}.

{noformat}
import org.junit.Test;
import org.tuckey.web.filters.urlrewrite.utils.RegexPattern;
import org.tuckey.web.filters.urlrewrite.utils.StringMatchingMatcher;
import org.tuckey.web.filters.urlrewrite.utils.StringMatchingPattern;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class PatternMatcherTest {

    public static final String FROM = "(?!.+\\.jpg)(/usergenerated/.)";

    @Test
    public void testJpg() throws Exception {
        final String url = "/usergenerated/users/olli/profile.jpg";
        final StringMatchingPattern pattern = new RegexPattern(FROM, true);
        final StringMatchingMatcher matcher = pattern.matcher(url);
        assertFalse(matcher.find());
    }

    @Test
    public void testSwf() throws Exception {
        final String url = "/usergenerated/users/antonio/profile.swf";
        final StringMatchingPattern pattern = new RegexPattern(FROM, true);
        final StringMatchingMatcher matcher = pattern.matcher(url);
        assertTrue(matcher.find());
    }

}
{noformat}

> Add support for Content-Disposition attachment 
> -----------------------------------------------
>
>                 Key: SLING-3829
>                 URL: https://issues.apache.org/jira/browse/SLING-3829
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Antonio Sanso
>            Assignee: Antonio Sanso
>            Priority: Minor
>
> In some situation will be useful (and safer) to force Content-Disposition 
> attachment for some Content-Type (configurable ) under some specific (and 
> sensitive) path (configurable)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to