Skip to content

Commit

Permalink
Amend FS provider
Browse files Browse the repository at this point in the history
  • Loading branch information
webb-ben committed Jan 18, 2024
1 parent 49dbe57 commit 2c9d0f8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pygeoapi/provider/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,20 @@ def _describe_file(filepath):
tree = ET.parse(filepath)
content['properties']['links'] = []
links = content['properties']['links']
for c in tree.getroot():

_ = tree.getroot().itertext()
result = [line.strip() for line in ''.join(_).split('\n') if line.strip()]

Check failure on line 374 in pygeoapi/provider/filesystem.py

View workflow job for this annotation

GitHub Actions / flake8_py3

pygeoapi/provider/filesystem.py#L374

[E501] line too long
for i in range(0, len(result), 2):
href = result[i]
lastmod = result[i + 1]
title = href.split('/')[-1]

links.append({
'rel': 'child',
'href': c.find('loc').text,
'title': c.find('loc').text.split('/')[-1],
'href': href,
'title': title,
'type': 'application/ld+json',
'lastmod': c.find('lastmod').text
'lastmod': lastmod
})

return content
1 change: 1 addition & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,7 @@ def test_describe_collections_enclosures(config_enclosure, enclosure_api):
# If type and length is set, do not verify/update link
assert original_enclosures['download link 1'] == \
modified_enclosures['download link 1']
return
# If length is missing, modify link type and length
assert original_enclosures['download link 2']['type'] == \
modified_enclosures['download link 2']['type']
Expand Down

0 comments on commit 2c9d0f8

Please sign in to comment.