Split extension at first . when looking for an extension,

prevents us from considering .txt.pdf a PDF for the purpose of RFCs.
Fixes #807.
 - Legacy-Id: 4082
This commit is contained in:
Ole Laursen 2012-03-14 18:47:21 +00:00
parent 0608d52a09
commit 3731f7cccc

View file

@ -60,8 +60,13 @@ class InternetDraft(Document):
possible_types = [".txt", ".pdf", ".xml", ".ps"]
res = []
for m in glob.glob(glob_path):
i = m.find(".")
if i == -1:
ext = ""
else:
ext = m[i:]
for t in possible_types:
if m.endswith(t):
if t == ext:
res.append(t)
return ",".join(res)
#file_type = models.CharField(max_length=20)