Skip to content

Commit 3a3fd33

Browse files
authored
Merge pull request #702 from jpopelka/svg-is-not-source
Don't mark SVG files as source
2 parents 0d1bfba + bff37e7 commit 3a3fd33

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/typecode/contenttype.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,9 +459,11 @@ def is_source(self):
459459
return False
460460

461461
ft = self.filetype_file.lower()
462-
pt = self.filetype_pygment
462+
pt = self.filetype_pygment.lower()
463463

464-
if not 'xml' in ft and (pt or self.is_script is True):
464+
if 'xml' not in ft and \
465+
('xml' not in pt or self.location.endswith('pom.xml')) and \
466+
(pt or self.is_script is True):
465467
return True
466468
else:
467469
return False

tests/typecode/test_contenttype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ def test_media_image_svg(self):
877877
test_file = self.get_test_loc('contenttype/media/drawing.svg')
878878
assert not is_binary(test_file)
879879
assert is_media(test_file)
880-
assert is_media(test_file)
880+
assert not is_source(test_file)
881881

882882
def test_media_image_tgg(self):
883883
test_file = self.get_test_loc('contenttype/media/Image1.tga')

0 commit comments

Comments
 (0)