Skip to content
This repository was archived by the owner on Oct 6, 2024. It is now read-only.

Commit 9f038a2

Browse files
committed
Update character encoding to utf-8
Fix clippy errors in package Add sendRawEmail ses policy
1 parent e8e88f7 commit 9f038a2

File tree

7 files changed

+61
-72
lines changed

7 files changed

+61
-72
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
**IMPORTANT: Please do not create a Pull Request without creating an issue first.**
1+
## Proposed changes
2+
Describe the *big picture* reason for your PR.
23

3-
*Any change needs to be reviewed before it's merged*
4+
## Checklist
45

5-
## Description
6-
<!-- Please provide enough information so that others can review your pull request -->
6+
Please review the following checklist before submitting a PR:
77

8-
Explain the **details** for making this change. What existing problem does the pull request solve?
8+
- [ ] **CONSIDER** adding a unit test to demonstrate your PR resolves an issue
9+
- [ ] **DO** keep PRs small for easy review
10+
- [ ] **DO** make sure unit tests pass
11+
- [ ] **DO** ensure no compiler warnings are triggered
12+
- [ ] **AVOID** breaking the CI builds
913

10-
<!-- Example: When "Adding a function to do X", explain why it is necessary to have a way to do X. -->
11-
12-
### Issue Number
13-
<!-- Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if such). -->
14-
15-
## Test Plan **required**
16-
17-
Demonstrate the code is solid. ( Exact commands you ran and their output, screenshots / videos if the pull request changes UI.)
18-
19-
<!-- Make sure tests pass on both Travis and Circle CI. -->
14+
## Other comments
15+
Any other comments you might have.
2016

2117
## Reviewers
2218
<!-- add reviewers -->

.github/workflows/rust.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,34 @@ on: [push, pull_request]
77
env:
88
CARGO_TERM_COLOR: always
99

10+
1011
jobs:
1112
build-and-run-tests:
1213
runs-on: ubuntu-latest
14+
environment: development
15+
strategy:
16+
matrix:
17+
rust:
18+
- stable
1319
steps:
14-
- uses: actions/checkout@v2
15-
- name: Build
16-
run: cargo build --verbose
17-
- name: Run tests
18-
run: cargo test --verbose
20+
- uses: actions/checkout@v2
21+
- uses: actions-rs/toolchain@v1
22+
with:
23+
profile: minimal
24+
toolchain: ${{ matrix.rust }}
25+
override: true
26+
components: rustfmt, clippy
27+
- uses: actions-rs/cargo@v1
28+
with:
29+
command: build
30+
- uses: actions-rs/cargo@v1
31+
with:
32+
command: test
33+
- uses: actions-rs/cargo@v1
34+
with:
35+
command: fmt
36+
args: --all -- --check
37+
- uses: actions-rs/cargo@v1
38+
with:
39+
command: clippy
40+
args: -- -D warnings

src/config.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ impl PrivatEmailConfig {
5050
/// Create new PrivatEmailConfig struct from environment variables.
5151
pub fn new_from_env() -> Self {
5252
let b_list = env::var("BLACK_LIST").unwrap_or_default();
53-
let black_list = b_list
54-
.split(",")
55-
.map(|x| String::from(x.replace(" ", "")))
56-
.collect();
53+
let black_list =
54+
b_list.split(',').map(|x| x.replace(" ", "")).collect();
5755

5856
PrivatEmailConfig {
5957
from_email: env::var("FROM_EMAIL")
@@ -72,10 +70,8 @@ impl PrivatEmailConfig {
7270
B: ToString,
7371
{
7472
let b_list_vec = black_list.to_string();
75-
let b_list: Vec<String> = b_list_vec
76-
.split(",")
77-
.map(|x| String::from(x.replace(" ", "")))
78-
.collect();
73+
let b_list: Vec<String> =
74+
b_list_vec.split(',').map(|x| x.replace(" ", "")).collect();
7975
PrivatEmailConfig {
8076
from_email: from_email.to_string(),
8177
to_email: to_email.to_string(),

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ pub(crate) async fn privatemail_handler(
188188
let subject: String = ses_mail.mail.common_headers.subject.to_string();
189189

190190
// parse email content
191-
let parsed_mail = parse_mail(&ses_mail.content.as_bytes()).unwrap();
191+
let parsed_mail = parse_mail(ses_mail.content.as_bytes()).unwrap();
192192
let mail_content = parsed_mail.subparts[1].get_body_raw().unwrap();
193193
let msg_body = charset::decode_latin1(&mail_content).to_string();
194194
trace!("HTML content: {:#?}", mail_content);

terraform/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ data "aws_iam_policy_document" "ses_email_forward_policy_document" {
5656

5757
actions = [
5858
"ses:SendEmail",
59+
"ses:SendRawEmail",
5960
]
6061

6162
resources = [

tests/payload/test_event.json

Lines changed: 17 additions & 17 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)