geopython / pycsw

pycsw is an OGC CSW server implementation written in Python. pycsw fully implements the OpenGIS Catalogue Service Implementation Specification [Catalogue Service for the Web]. Initial development started in 2010 (more formally announced in 2011). The project is certified OGC Compliant, and is an OGC Reference Implementation. pycsw allows for the publishing and discovery of geospatial metadata via numerous APIs (CSW 2/CSW 3, OpenSearch, OAI-PMH, SRU). Existing repositories of geospatial metadata can also be exposed, providing a standards-based metadata and catalogue component of spatial data infrastructures. pycsw is Open Source, released under an MIT license, and runs on all major platforms (Windows, Linux, Mac OS X). Please read the docs at https://pycsw.org/docs for more information.
https://pycsw.org
MIT License
198 stars 153 forks source link

record output fails if empty contacts #893

Closed pvgenuchten closed 10 months ago

pvgenuchten commented 10 months ago

Description

a problem when contacts is empty

  File "/home/pycsw/pycsw/pycsw/ogc/api/records.py", line 828, in item
    response = record2json(record, self.config['server']['url'], collection, stac_item)
  File "/home/pycsw/pycsw/pycsw/ogc/api/records.py", line 1065, in record2json
    for cnt in json.loads(record.contacts):
  File "/usr/lib/python3.8/json/__init__.py", line 341, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType

add check to see if contacts in '' or none

Environment