Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
cloudooo cloudooo
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • cloudooocloudooo
  • Merge requests
  • !30

Merged
Created Mar 22, 2022 by Jérome Perrin@jeromeOwner

Fix mimetypes usage in handlers

  • Overview 4
  • Commits 1
  • Pipelines 2
  • Changes 5

cloudooo includes its own mimes.types, so that it does not depend on system configuration and behave the same regardless of the underlying system, but the embedded mime.types have to be loaded explicitly by calling utils.loadMimetypeList() by each python process before using mimetypes module.

This was not done for ooo and x2t handlers, so in practice they were depending on the system mime.types and the tests were written to expect the mimetypes from debian 10, but with debian 11 some mimetypes became different ( for example .bmp extension was guessed as image/x-ms-bmp 1 on debian 10 and image/bmp on debian 11 2),

Theses changes:

  • include mime.types from debian 10 3, but keeping the extra mimetypes for only-office documents (docy, ppty and xlsy) that were added in 0bb5fbdc (x2t: add handler, 2016-09-22)
  • change the handlers to call utils.loadMimetypeList(), it was only strictly necessary for ooo handler, but do it as well in x2t for consistency.
  • adjust some tests in testX2tHandler, because now that we have loaded mimetypes database the mimetype of xlsy is returned in metadata, so we have "application/x-asc-spreadsheet" and not just "xlsy"
  • add a few more test for xlsy and docy, because the magic based test just verify that they are zip files, these new tests also make a few assertions on the content of the zip files
Edited May 13, 2022 by Jérome Perrin
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: fix/mimes_types_debian_11
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7