Skip to content

Commit

Permalink
Merge pull request #172 from oduwsdl/pandora-urir-fix
Browse files Browse the repository at this point in the history
Pandora urir fix, closes #171
  • Loading branch information
shawnmjones committed Feb 22, 2021
2 parents a836ea3 + c2242fa commit 71de655
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '0.2021.02.01.205105'
release = '0.2021.02.22.022825'


# -- General configuration ---------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions mementoembed/mementoresource.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ def get_original_uri_from_response(response):
# urir = aiu.convert_LinkTimeMap_to_dict(
# response.headers['link'] )['original_uri']
urir = response.links['original']['url']

if 'pandora.nla.gov.au/pan/' in urir:
# TODO: make regex
module_logger.info("discovered URI-R {} with hostname pandora.nla.gov, fixing...".format(urir))
urir = re.sub(r'http[s]?://pandora.nla.gov.au/pan/[0-9]*/[0-9]*-[0-9]*/(.*)', r'\1', urir)
if urir[0:4] != 'http':
urir = "http://{}".format(urir)

except KeyError as e:
raise NotAMementoError(
"link header could not be parsed for original URI",
Expand Down
2 changes: 1 addition & 1 deletion mementoembed/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__appname__ = "MementoEmbed"
__appversion__ = '0.2021.02.01.205105'
__appversion__ = '0.2021.02.22.022825'
__useragent__ = "{}/{}".format(__appname__, __appversion__)

0 comments on commit 71de655

Please sign in to comment.