mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-10 03:37:28 -03:00
Force the MIME type for .js files to be text/javascript, to override silly OS databases/registries with incorrect settings, which Flask would otherwise depend on
This commit is contained in:
parent
4b18cb7d0f
commit
e6a17bc743
1 changed files with 11 additions and 0 deletions
|
@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
import logging
|
||||
import mimetypes
|
||||
import os
|
||||
import queue
|
||||
import requests
|
||||
|
@ -80,6 +81,16 @@ class Web:
|
|||
|
||||
self.settings = mode_settings
|
||||
|
||||
# Flask guesses the MIME type of files from a database on the operating
|
||||
# system.
|
||||
# Some operating systems, or applications that can modify the database
|
||||
# (such as the Windows Registry) can treat .js files as text/plain,
|
||||
# which breaks the chat app due to X-Content-Type-Options: nosniff.
|
||||
#
|
||||
# It's probably #notourbug but we can fix it by forcing the mimetype.
|
||||
# https://github.com/onionshare/onionshare/issues/1443
|
||||
mimetypes.add_type('text/javascript', '.js')
|
||||
|
||||
# The flask app
|
||||
self.app = Flask(
|
||||
__name__,
|
||||
|
|
Loading…
Reference in a new issue