Commit c72c8a9
committed
astextplain: use mimetype to decide helper
We use the file extension to determine which helper to call to convert a
file to text. We currently match an all upper case version and an all
lower case version of each extension, but sometimes variations like
'foo.Rtf' fall though our raster.
To cover all variations in this established way we'd have to add every
permutation of upper and lower case for each extension to the script.
That's a big maintainance burden.
We could also convert the passed filename to a known case and match
against that. Since POSIX has no easy way for sh to do case conversion
in-process we'd have to shell out to tr, awk or similar.
For the antiword helper we already need to make sure the file is of the
type it claims by it's extension. We use file to tell us the mimetype
for this. file can also tell us the types of other files we care about
for astextplain, so we can use it for the decision which helper to use
in the first place.
This fixes git-for-windows/git#5641
Signed-off-by: Matthias Aßhauer <mha1993@live.de>1 parent 684e552 commit c72c8a9
2 files changed
+8
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 14 | + | |
| 15 | + | |
23 | 16 | | |
24 | | - | |
| 17 | + | |
25 | 18 | | |
26 | 19 | | |
27 | | - | |
| 20 | + | |
28 | 21 | | |
29 | 22 | | |
30 | 23 | | |
31 | | - | |
| 24 | + | |
32 | 25 | | |
33 | 26 | | |
34 | 27 | | |
| |||
0 commit comments