Skip to content

Commit

Permalink
Added a directoryUrl retrieval in get_dirlist_url
Browse files Browse the repository at this point in the history
  • Loading branch information
turetske committed May 21, 2024
1 parent b487e6e commit 9f7be59
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/pelicanfs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,18 @@ async def get_dirlist_url(self, fileloc: str) -> str:
"""
Returns a dirlist host url for the given namespace locations
"""

if not self.directorUrl:
metadata_json = await self._discover_federation_metadata(self.discoveryUrl)
# Ensure the director url has a '/' at the end
directorUrl = metadata_json.get('director_endpoint')
if not directorUrl:
raise InvalidMetadata()

if not directorUrl.endswith("/"):
directorUrl = directorUrl + "/"
self.directorUrl = directorUrl

url = urllib.parse.urljoin(self.directorUrl, fileloc)

# Timeout response in seconds - the default response is 5 minutes
Expand Down

0 comments on commit 9f7be59

Please sign in to comment.