Commit 3d54323
refactor: address review feedback (IntegrityError, single algorithm map, README reorg)
Per review from @grosser:
- Add CssParser::IntegrityError < RemoteFileError, raised specifically on
an SRI mismatch, so callers can distinguish it from other fetch
failures (404, SSRF rejection, timeout) while remaining catchable by
existing `rescue RemoteFileError` code. Required a small fix to the
method's catch-all rescue, which previously downgraded any exception
raised inside it (including the new IntegrityError) back to a plain
RemoteFileError -- now only IntegrityError specifically is let through
unchanged, preserving existing behavior/tests for other error paths.
- Merge INTEGRITY_ALGORITHM_PRIORITY and the inline digest-class lookup
into one INTEGRITY_ALGORITHMS hash (algorithm => Digest class, ordered
strongest first), so there's a single structure to keep in sync instead
of two.
- Move the Subresource Integrity usage examples out of the main Usage
code block into their own README section, since it's a less-common,
advanced option.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>1 parent 7f5e236 commit 3d54323
3 files changed
Lines changed: 80 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 26 | | |
47 | 27 | | |
48 | 28 | | |
| |||
91 | 71 | | |
92 | 72 | | |
93 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
94 | 107 | | |
95 | 108 | | |
96 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
11 | 18 | | |
12 | 19 | | |
13 | 20 | | |
| |||
42 | 49 | | |
43 | 50 | | |
44 | 51 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
51 | 63 | | |
52 | 64 | | |
53 | 65 | | |
| |||
508 | 520 | | |
509 | 521 | | |
510 | 522 | | |
511 | | - | |
512 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
513 | 526 | | |
514 | 527 | | |
515 | 528 | | |
| |||
733 | 746 | | |
734 | 747 | | |
735 | 748 | | |
736 | | - | |
| 749 | + | |
737 | 750 | | |
738 | 751 | | |
739 | 752 | | |
| |||
743 | 756 | | |
744 | 757 | | |
745 | 758 | | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
746 | 769 | | |
747 | 770 | | |
748 | 771 | | |
| |||
761 | 784 | | |
762 | 785 | | |
763 | 786 | | |
764 | | - | |
| 787 | + | |
765 | 788 | | |
766 | 789 | | |
767 | 790 | | |
768 | | - | |
| 791 | + | |
| 792 | + | |
769 | 793 | | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
774 | | - | |
775 | | - | |
| 794 | + | |
776 | 795 | | |
777 | 796 | | |
778 | 797 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
80 | 89 | | |
81 | 90 | | |
82 | 91 | | |
| |||
96 | 105 | | |
97 | 106 | | |
98 | 107 | | |
99 | | - | |
| 108 | + | |
100 | 109 | | |
101 | 110 | | |
102 | 111 | | |
| |||
122 | 131 | | |
123 | 132 | | |
124 | 133 | | |
125 | | - | |
| 134 | + | |
126 | 135 | | |
127 | 136 | | |
128 | 137 | | |
| |||
0 commit comments