Skip to content

Commit be4ebc8

Browse files
committed
IPR disclosures: Don't include .doc/.html inline; don't fail if file does not exist
- Legacy-Id: 2055
1 parent db090de commit be4ebc8

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

ietf/ipr/views.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,14 @@ def show(request, ipr_id=None, removed=None):
9595
ipr.is_pending = dict(SELECT_CHOICES)[ipr.is_pending]
9696
if ipr.applies_to_all:
9797
ipr.applies_to_all = dict(SELECT_CHOICES)[ipr.applies_to_all]
98-
if ipr.legacy_url_0 and ipr.legacy_url_0.startswith("http://www.ietf.org/") and not ipr.legacy_url_0.endswith(".pdf"):
99-
file = open(os.path.join(settings.IPR_DOCUMENT_PATH, os.path.basename(ipr.legacy_url_0)))
100-
ipr.legacy_text = file.read().decode("latin-1")
101-
file.close()
98+
if ipr.legacy_url_0 and ipr.legacy_url_0.startswith("http://www.ietf.org/") and not ipr.legacy_url_0.endswith((".pdf",".doc",".html")):
99+
try:
100+
file = open(os.path.join(settings.IPR_DOCUMENT_PATH, os.path.basename(ipr.legacy_url_0)))
101+
ipr.legacy_text = file.read().decode("latin-1")
102+
file.close()
103+
except:
104+
# if file does not exist, iframe is used instead
105+
pass
102106
return render("ipr/details.html", {"ipr": ipr, "section_list": section_list},
103107
context_instance=RequestContext(request))
104108

0 commit comments

Comments
 (0)