Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions src/main/java/com/sendgrid/helpers/mail/objects/Content.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,8 @@
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.regex.Pattern;
import java.lang.IllegalArgumentException;

/**
* An object in which you may specify the content of your email.
* An object in which you may specify the content of your email.
*/
@JsonInclude(Include.NON_DEFAULT)
public class Content {
Expand Down Expand Up @@ -44,7 +36,6 @@ public String getValue() {
}

public void setValue(String value) {
ContentVerifier.verifyContent(value);
this.value = value;
}

Expand Down Expand Up @@ -79,17 +70,3 @@ public boolean equals(Object obj) {
return true;
}
}

class ContentVerifier {
private static final List<Pattern> FORBIDDEN_PATTERNS = Collections.singletonList(
Pattern.compile(".*SG\\.[a-zA-Z0-9(-|_)]*\\.[a-zA-Z0-9(-|_)]*.*")
);

static void verifyContent(String content) {
for (Pattern pattern: FORBIDDEN_PATTERNS) {
if (pattern.matcher(content).matches()) {
throw new IllegalArgumentException("Found a Forbidden Pattern in the content of the email");
}
}
}
}
48 changes: 0 additions & 48 deletions src/test/java/com/sendgrid/helpers/ContentTest.java

This file was deleted.