diff options
| author | Noel Peden <[email protected]> | 2022-04-11 05:24:55 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-04-11 05:24:55 -0700 |
| commit | ed6e1ebddff733f8bb56399aa4dc9774096ba1c1 (patch) | |
| tree | 603a6be5c392fa24c282e0ddacaf930433ea38fb /lib | |
| parent | 6646077352fe84430c14415f354bc0c73f73fd7d (diff) | |
| parent | b6617ef71ef9980951f7eb30955ac73b7231e3a5 (diff) | |
| download | caxlsx-ed6e1ebddff733f8bb56399aa4dc9774096ba1c1.tar.gz caxlsx-ed6e1ebddff733f8bb56399aa4dc9774096ba1c1.zip | |
Merge pull request #139 from ytjmt/sort_archive_entries_for_correct_mime_detection
Sort archive entries for correct MIME detection with `file` command
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/package.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index 1b30c815..2faec2e3 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -206,12 +206,10 @@ module Axlsx # @private def parts parts = [ - {:entry => RELS_PN, :doc => relationships, :schema => RELS_XSD}, {:entry => "xl/#{STYLES_PN}", :doc => workbook.styles, :schema => SML_XSD}, {:entry => CORE_PN, :doc => @core, :schema => CORE_XSD}, {:entry => APP_PN, :doc => @app, :schema => APP_XSD}, {:entry => WORKBOOK_RELS_PN, :doc => workbook.relationships, :schema => RELS_XSD}, - {:entry => CONTENT_TYPES_PN, :doc => content_types, :schema => CONTENT_TYPES_XSD}, {:entry => WORKBOOK_PN, :doc => workbook, :schema => SML_XSD} ] @@ -256,7 +254,11 @@ module Axlsx end # Sort parts for correct MIME detection - parts.sort_by { |part| part[:entry] } + [ + {:entry => CONTENT_TYPES_PN, :doc => content_types, :schema => CONTENT_TYPES_XSD}, + {:entry => RELS_PN, :doc => relationships, :schema => RELS_XSD}, + *(parts.sort_by { |part| part[:entry] }.reverse) + ] end # Performs xsd validation for a signle document |
