Metadata-Version: 2.1
Name: odoo-addon-attachment_mimetype_restriction
Version: 15.0.1.0.0.2
Summary: Restrict attachment uploads to an allowlist of MIME types
Home-page: https://github.com/OCA/social
Author: Quartile, Odoo Community Association (OCA)
Author-email: support@odoo-community.org
License: AGPL-3
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 15.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Requires-Python: >=3.8
Requires-Dist: odoo<15.1dev,>=15.0a

.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

================================
Attachment MIME Type Restriction
================================

.. 
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! source digest: sha256:967c51f8dcbe91237a62876f00284900256f676d2ea32722d75eb75c5830e32d
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
    :target: https://odoo-community.org/page/development-status
    :alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
    :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
    :target: https://github.com/OCA/social/tree/15.0/attachment_mimetype_restriction
    :alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/social-15-0/social-15-0-attachment_mimetype_restriction
    :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
    :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=15.0
    :alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module restricts attachment uploads to an explicit allowlist of MIME types
using content-based detection rather than filename extensions. Only configured
MIME types are accepted; everything else is rejected. Leaving the allowlist
empty disables the restriction and allows all file types.

For incoming emails, the email itself is always accepted, but any attachments
whose MIME type is not in the allowlist are stripped out before the message is
saved. A security notice is then posted on the related record listing the
removed files, so users can see what was filtered.

**Table of contents**

.. contents::
   :local:

Configuration
=============

**Global Configuration (Company-wide):**

#. Go to Settings → General Settings
#. In the "Allowed Attachment Types" field, enter comma-separated MIME types
#. Example: ``image/png,application/pdf``
#. Leave empty to allow all file types

**Per-Model Configuration (Optional):**

#. Go to Settings → Technical → Database Structure → Models
#. Select a model (e.g., "Contact" for res.partner)
#. In the "Allowed Attachment Types" field, enter comma-separated MIME types
#. Empty value = use global config; set value = override global config

**Configuration Hierarchy:**

Per-model settings override global settings when defined.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/social/issues/new?body=module:%20attachment_mimetype_restriction%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Quartile

Contributors
~~~~~~~~~~~~

- Quartile \<<https://www.quartile.co>\>
  - Aung Ko Ko Lin

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-yostashiro| image:: https://github.com/yostashiro.png?size=40px
    :target: https://github.com/yostashiro
    :alt: yostashiro
.. |maintainer-aungkokolin1997| image:: https://github.com/aungkokolin1997.png?size=40px
    :target: https://github.com/aungkokolin1997
    :alt: aungkokolin1997

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-yostashiro| |maintainer-aungkokolin1997| 

This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.0/attachment_mimetype_restriction>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
