Class: Excavate::NestedCabFallback
- Inherits:
-
Object
- Object
- Excavate::NestedCabFallback
- Defined in:
- lib/excavate/nested_cab_fallback.rb
Overview
Decides whether a failed extraction of a :exe-typed archive
should be retried as a CAB.
Some self-extracting EXEs produced by older Microsoft toolchains wrap a CAB rather than a 7z payload. When the 7z reader fails to parse one of these, it surfaces a small number of distinctive error strings. Rather than sniffing those strings inline inside Archive's rescue clause, the heuristic is named and tested here.
Constant Summary collapse
- SIGNATURE_PHRASES =
[ /\AInvalid file format/, /\AUnrecognized archive format/, /Invalid \.7z signature/, ].freeze
Class Method Summary collapse
Class Method Details
.applies_to?(type, error) ⇒ Boolean
20 21 22 |
# File 'lib/excavate/nested_cab_fallback.rb', line 20 def applies_to?(type, error) type == :exe && phrase_match?(error.) end |