Skip to content

fix(repositories): handle None values in resource_search filters (#101)#102

Merged
rbardaji merged 1 commit intomainfrom
fix/101-resource-search-none-fields
Apr 13, 2026
Merged

fix(repositories): handle None values in resource_search filters (#101)#102
rbardaji merged 1 commit intomainfrom
fix/101-resource-search-none-fields

Conversation

@rbardaji
Copy link
Copy Markdown
Collaborator

Summary

  • Fix AttributeError: 'NoneType' object has no attribute 'lower' in /resources/search when a resource has None values in name, url, description or format (resource_search crashes with AttributeError when resource fields are None #101)
  • Replace resource.get(key, \"\") with (resource.get(key) or \"\") in every filter branch of DataCatalogRepository.resource_search — the previous form only falls back to the default when the key is missing, not when it exists with value None
  • Add a regression test covering None values across all searchable fields (query, name, url, format, description)
  • Bump version to 0.10.11 and update CHANGELOG.md

Test plan

  • docker compose exec api python -m pytest tests/ -v — 1012 passed
  • New regression test test_search_with_none_fields_does_not_crash passes and fails on the previous code
  • Manual reproduction in the running container: before the fix raises AttributeError, after the fix returns a valid result set
  • black --check and flake8 --max-line-length=88 clean on the modified files

Closes #101

resource_search crashed with AttributeError when resources had None
values in name, url, description or format fields. dict.get(key, '')
only returns the default when the key is missing, not when it exists
with value None, so .lower() was being called on None.

Use (resource.get(key) or '') in all filter branches and add a
regression test covering None values across all searchable fields.

Closes #101
@rbardaji rbardaji merged commit fb89977 into main Apr 13, 2026
1 check passed
@rbardaji rbardaji deleted the fix/101-resource-search-none-fields branch April 13, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resource_search crashes with AttributeError when resource fields are None

1 participant