Skip to content

Commit f76c46b

Browse files
committed
Partially addresses issue ietf-tools#1926 still displaying markdown as text. Fixes ietf-tools#2704. Commit ready for merge.
- Legacy-Id: 16557
1 parent c3ffd09 commit f76c46b

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

ietf/doc/views_doc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,9 @@ def document_main(request, name, rev=None):
586586
if extension == ".txt":
587587
content = doc.text_or_error() # pyflakes:ignore
588588
t = "plain text"
589+
elif extension == ".md":
590+
content = doc.text_or_error() # pyflakes:ignore
591+
t = "markdown"
589592
other_types.append((t, url))
590593

591594
return render(request, "doc/document_material.html",

ietf/meeting/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def clean_file(self):
342342
self.file_encoding = {}
343343
self.file_encoding[file.name] = encoding.replace('charset=','') if encoding else None
344344
if self.mime_types:
345-
if mime_type != file.content_type:
345+
if mime_type != file.content_type and not file.content_type in settings.MEETING_VALID_MAGIC_MIME_TYPES[mime_type]:
346346
raise ValidationError('Upload Content-Type (%s) is different from the observed mime-type (%s)' % (file.content_type, mime_type))
347347
if mime_type in settings.MEETING_VALID_MIME_TYPE_EXTENSIONS:
348348
if not ext in settings.MEETING_VALID_MIME_TYPE_EXTENSIONS[mime_type]:

ietf/settings.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,18 +814,24 @@ def skip_unreadable_post(record):
814814
}
815815

816816
MEETING_VALID_UPLOAD_MIME_TYPES = {
817-
'agenda': ['text/plain', 'text/html', ],
818-
'minutes': ['text/plain', 'text/html', 'application/pdf', ],
817+
'agenda': ['text/plain', 'text/html', 'text/markdown', ],
818+
'minutes': ['text/plain', 'text/html', 'application/pdf', 'text/markdown', ],
819819
'slides': [],
820820
'bluesheets': ['application/pdf', 'text/plain', ],
821821
}
822822

823823
MEETING_VALID_MIME_TYPE_EXTENSIONS = {
824824
'text/plain': ['.txt', '.md', ],
825+
'text/markdown': ['.txt', '.md', ],
825826
'text/html': ['.html', '.htm'],
826827
'application/pdf': ['.pdf'],
827828
}
828829

830+
MEETING_VALID_MAGIC_MIME_TYPES = {
831+
'text/plain': ['text/plain', 'text/markdown', ],
832+
'text/html': ['text/html', ],
833+
'application/pdf': ['application/pdf', ],
834+
}
829835

830836
INTERNET_DRAFT_DAYS_TO_EXPIRE = 185
831837

ietf/templates/meeting/session_agenda_include.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h4 class="modal-title" id="label-{{item.slug}}">
1616
<div class="modal-body">
1717
{% with item.session.agenda as agenda %}
1818
{% if agenda %}
19-
{% if agenda.file_extension == "txt" or agenda.file_extension == "html" or agenda.file_extension == "htm" %}
19+
{% if agenda.file_extension == "txt" or agenda.file_extension == "md" or agenda.file_extension == "html" or agenda.file_extension == "htm" %}
2020
<h4>Agenda</h4>
2121
<div class="frame" data-src="{{agenda.href}}"></div>
2222
{% else %}
@@ -41,7 +41,7 @@ <h4>Slides</h4>
4141

4242
{% with item.session.minutes as minutes %}
4343
{% if minutes %}
44-
{% if minutes.file_extension == "txt" or minutes.file_extension == "html" or minutes.file_extension == "htm" %}
44+
{% if minutes.file_extension == "txt" or minutes.file_extension == "md" or minutes.file_extension == "html" or minutes.file_extension == "htm" %}
4545
<h4>Minutes</h4>
4646
<div class="frame2" data-src="{{minutes.href}}"></div>
4747
{% else %}

0 commit comments

Comments
 (0)