Skip to content

Commit f0b8f72

Browse files
almostcyberdelia
authored andcommitted
Mime types should not be unicode strings
1 parent 3f5ad20 commit f0b8f72

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

pipeline/conf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@
6363
'PIPELINE_LESS_ARGUMENTS': '',
6464

6565
'PIPELINE_MIMETYPES': (
66-
('text/coffeescript', '.coffee'),
67-
('text/less', '.less'),
68-
('text/javascript', '.js'),
69-
('text/x-sass', '.sass'),
70-
('text/x-scss', '.scss')
66+
(b'text/coffeescript', '.coffee'),
67+
(b'text/less', '.less'),
68+
(b'application/javascript', '.js'),
69+
(b'text/x-sass', '.sass'),
70+
(b'text/x-scss', '.scss')
7171
),
7272

7373
'PIPELINE_EMBED_MAX_IMAGE_SIZE': 32700,

pipeline/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def guess_type(path, default=None):
3636
mimetype, _ = mimetypes.guess_type(path)
3737
if not mimetype:
3838
return default
39-
return mimetype
39+
return smart_str(mimetype)
4040

4141

4242
def relpath(path, start=posixpath.curdir):

tests/tests/test_template.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ def test_package_css_disabled(self):
3535

3636
def test_package_js(self):
3737
template = self.env.from_string(u"""{% compressed_js "scripts" %}""")
38-
self.assertEqual(u'<script type="text/javascript" src="/static/scripts.js" charset="utf-8"></script>', template.render())
38+
self.assertEqual(u'<script type="application/javascript" src="/static/scripts.js" charset="utf-8"></script>', template.render())
3939

4040
def test_package_js_async(self):
4141
template = self.env.from_string(u"""{% compressed_js "scripts_async" %}""")
42-
self.assertEqual(u'<script async type="text/javascript" src="/static/scripts_async.js" charset="utf-8"></script>', template.render())
42+
self.assertEqual(u'<script async type="application/javascript" src="/static/scripts_async.js" charset="utf-8"></script>', template.render())
4343

4444
def test_package_js_defer(self):
4545
template = self.env.from_string(u"""{% compressed_js "scripts_defer" %}""")
46-
self.assertEqual(u'<script defer type="text/javascript" src="/static/scripts_defer.js" charset="utf-8"></script>', template.render())
46+
self.assertEqual(u'<script defer type="application/javascript" src="/static/scripts_defer.js" charset="utf-8"></script>', template.render())
4747

4848
def test_package_js_async_defer(self):
4949
template = self.env.from_string(u"""{% compressed_js "scripts_async_defer" %}""")
50-
self.assertEqual(u'<script async defer type="text/javascript" src="/static/scripts_async_defer.js" charset="utf-8"></script>', template.render())
50+
self.assertEqual(u'<script async defer type="application/javascript" src="/static/scripts_async_defer.js" charset="utf-8"></script>', template.render())
5151

5252

5353
class DjangoTest(TestCase):
@@ -64,16 +64,16 @@ def test_compressed_css(self):
6464

6565
def test_compressed_js(self):
6666
rendered = self.render_template(u"""{% load compressed %}{% compressed_js "scripts" %}""")
67-
self.assertEqual(u'<script type="text/javascript" src="/static/scripts.js" charset="utf-8"></script>', rendered)
67+
self.assertEqual(u'<script type="application/javascript" src="/static/scripts.js" charset="utf-8"></script>', rendered)
6868

6969
def test_compressed_js_async(self):
7070
rendered = self.render_template(u"""{% load compressed %}{% compressed_js "scripts_async" %}""")
71-
self.assertEqual(u'<script async type="text/javascript" src="/static/scripts_async.js" charset="utf-8"></script>', rendered)
71+
self.assertEqual(u'<script async type="application/javascript" src="/static/scripts_async.js" charset="utf-8"></script>', rendered)
7272

7373
def test_compressed_js_defer(self):
7474
rendered = self.render_template(u"""{% load compressed %}{% compressed_js "scripts_defer" %}""")
75-
self.assertEqual(u'<script defer type="text/javascript" src="/static/scripts_defer.js" charset="utf-8"></script>', rendered)
75+
self.assertEqual(u'<script defer type="application/javascript" src="/static/scripts_defer.js" charset="utf-8"></script>', rendered)
7676

7777
def test_compressed_js_async_defer(self):
7878
rendered = self.render_template(u"""{% load compressed %}{% compressed_js "scripts_async_defer" %}""")
79-
self.assertEqual(u'<script async defer type="text/javascript" src="/static/scripts_async_defer.js" charset="utf-8"></script>', rendered)
79+
self.assertEqual(u'<script async defer type="application/javascript" src="/static/scripts_async_defer.js" charset="utf-8"></script>', rendered)

0 commit comments

Comments
 (0)