You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by GitBox <gi...@apache.org> on 2021/05/28 12:49:06 UTC

[GitHub] [james-project] jeantil commented on a change in pull request #462: JAMES-2157 HasMimeType only look at the top level mime type

jeantil commented on a change in pull request #462:
URL: https://github.com/apache/james-project/pull/462#discussion_r641521543



##########
File path: mailet/standard/src/main/java/org/apache/james/transport/matchers/HasMimeType.java
##########
@@ -42,6 +42,8 @@
 /**
  * <p>This matcher checks if the content type matches.</p>
  *
+ * <p>This matcher do not walk down the mime tree and stops at the top level mime part.</p>

Review comment:
       ```suggestion
    * <p>This matcher does not walk down the mime tree and stops at the top level mime part.</p>
   ```

##########
File path: docs/modules/servers/partials/HasMimeTypeAnySubPart.adoc
##########
@@ -0,0 +1,11 @@
+=== HasMimeTypeAnySubPart
+
+This matcher checks if the content type matches.
+
+This matcher walk down the mime tree and will look up at all the mime parts of this message.

Review comment:
       ```suggestion
   This matcher walks down the mime tree and will look up at all the mime parts of this message.
   ```

##########
File path: docs/modules/servers/partials/HasMimeType.adoc
##########
@@ -2,6 +2,8 @@
 
 This matcher checks if the content type matches.
 
+This matcher do not walk down the mime tree and stops at the top level mime part.

Review comment:
       ```suggestion
   This matcher does not walk down the mime tree and stops at the top level mime part.
   ```

##########
File path: mailet/standard/src/main/java/org/apache/james/transport/matchers/HasMimeTypeAnySubPart.java
##########
@@ -0,0 +1,119 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.transport.matchers;
+
+import static org.apache.mailet.base.RFC2822Headers.CONTENT_TYPE;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Set;
+import java.util.stream.Stream;
+
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.Part;
+
+import org.apache.james.core.MailAddress;
+import org.apache.james.javax.MultipartUtil;
+import org.apache.james.mime4j.field.Fields;
+import org.apache.james.util.StreamUtils;
+import org.apache.mailet.Mail;
+import org.apache.mailet.MailetException;
+import org.apache.mailet.base.GenericMatcher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.github.fge.lambdas.Throwing;
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+
+
+/**
+ * <p>This matcher checks if the content type matches.</p>
+ *
+ * <p>This matcher walk down the mime tree and will look up at all the mime parts of this message.</p>

Review comment:
       ```suggestion
    * <p>This matcher walks down the mime tree and will try to match any of the mime parts of this message.</p>
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org