Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ietf/doc/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,19 @@ def _get_ref(self, meeting=None, meeting_doc_refs=settings.MEETING_DOC_HREFS):
info = dict(doc=self)

href = format.format(**info)

# For slides that are not meeting-related, we need to know the file extension.
# Assume we have access to the same files as settings.DOC_HREFS["slides"] and
# see what extension is available
if self.type_id == "slides" and not self.meeting_related() and not href.endswith("/"):
filepath = Path(self.get_file_path()) / self.get_base_name() # start with this
if not filepath.exists():
# Look for other extensions - grab the first one, sorted for stability
for existing in sorted(filepath.parent.glob(f"{filepath.stem}.*")):
filepath = filepath.with_suffix(existing.suffix)
break
href += filepath.suffix # tack on the extension

if href.startswith('/'):
href = settings.IDTRACKER_BASE_URL + href
self._cached_href = href
Expand Down