about summary refs log tree commit diff
path: root/t/1702-mshow-attachments.t
blob: 73f25177167e9b86bca24e42990b7609573c0bc2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh -e
cd ${0%/*}
. ./lib.sh
plan 2

# Different naming scenarios for named parts
cat <<EOF >tmp
Content-Type: multipart/mixed; boundary=----_NextPart_000_00DE_01D6A2E8.A7446C80

------_NextPart_000_00DE_01D6A2E8.A7446C80

no header, part is not attachment
------_NextPart_000_00DE_01D6A2E8.A7446C80
Content-Type: text/plain; charset=UTF-8

CT w/o name, part is not attachment
------_NextPart_000_00DE_01D6A2E8.A7446C80
Content-Type: text/plain; charset=UTF-8; name="ctn.txt"

CT with name, part is attachment
------_NextPart_000_00DE_01D6A2E8.A7446C80
Content-Disposition: attachment

CD w/o filename, part is not attachment
------_NextPart_000_00DE_01D6A2E8.A7446C80
Content-Type: text/plain; charset=UTF-8
Content-Disposition: attachment

CD w/o filename, CT w/o name, part is not attachment
------_NextPart_000_00DE_01D6A2E8.A7446C80
Content-Type: text/plain; charset=UTF-8; name="cd_ctn.txt"
Content-Disposition: attachment

CD w/o filename, CT with name, part is attachment
------_NextPart_000_00DE_01D6A2E8.A7446C80
Content-Disposition: attachment; filename="cdf.txt"

CD with filename, part is attachment
------_NextPart_000_00DE_01D6A2E8.A7446C80
Content-Type: text/plain; charset=UTF-8; name="cdf_ct.txt"
Content-Disposition: attachment

CD with filename, CT w/o name, part is attachment
------_NextPart_000_00DE_01D6A2E8.A7446C80
Content-Type: text/plain; charset=UTF-8; name="cdf_ctn.txt"
Content-Disposition: attachment; filename="cdf_ctn.txt"

CD with filename, CT with name, part is attachment
------_NextPart_000_00DE_01D6A2E8.A7446C80--
EOF

check 'mail has 10 parts' 'mshow -t ./tmp | wc -l | grep 11'
check 'mail has 5 named parts/attachments' 'mshow -t ./tmp | grep .*name=\".*\" | wc -l | grep 5'