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

ASF GitHub Bot commented on MIME4J-263:
---------------------------------------

GitHub user artur-jablonski opened a pull request:

    https://github.com/apache/james-mime4j/pull/15

    MIME4J-263, decoding encoded words with empty encoded-text

    Even though the rfc2047 specifies that the encoded-text in encoded word 
needs at least one character.
    
    I've seen this sort of encoded words around in emails, which the 
DecoderUtil.decodeEncodedWords() ignores and retuns as-is.
    
    This pull requests changes that behaviour to return an empty string in such 
cases

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/artur-jablonski/james-mime4j MIME4J-263

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/james-mime4j/pull/15.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #15
    
----
commit c3bc174f2c07f2be81c86710ac8415f2cbc524a3
Author: Artur Jablonski <[email protected]>
Date:   2017-08-18T09:51:40Z

    MIME4J-263, decoding encoded words with empty encoded-text

----


> DecoderUtil.decodeEncodedWords() doesn't decode an encoded empty string
> -----------------------------------------------------------------------
>
>                 Key: MIME4J-263
>                 URL: https://issues.apache.org/jira/browse/MIME4J-263
>             Project: James Mime4j
>          Issue Type: Bug
>          Components: parser (core)
>            Reporter: Artur Jablonski
>            Priority: Minor
>
> {{DecoderUtil.decodeEncodedWords()}} returns an unencoded string if the word 
> to decode is empty.
> For example
> {{DecoderUtil.decodeEncodedWords("=?utf-8?Q??=", DecodeMonitor.SILENT)}}
> returns
> {{"=?utf-8?Q??="}}
> instead of empty string (or perhaps null)
> The problem lies in the regexp that is used behind the scenes that requires 
> at least one character:
> {code}
> private static final Pattern PATTERN_ENCODED_WORD = Pattern.compile(
>             "(.*?)=\\?(.+?)\\?(\\w)\\?(.+?)\\?=", Pattern.DOTALL);
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to