Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrity field uses 'value' instead of 'hash' #30

Open
AissaGeek opened this issue Oct 29, 2024 · 0 comments
Open

Integrity field uses 'value' instead of 'hash' #30

AissaGeek opened this issue Oct 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@AissaGeek
Copy link

Description:

There is a bug in the get_hash_info method of the DownloadWorker class in downloader/__init__.py. The integrity field in the job payload uses 'value' instead of 'hash', which may lead to incorrect hash extraction.

Steps to reproduce

Consider this payload

 {
  "id": "41f08904-4246-44ed-94b0-c35922ff83e6",
  "type": "Feature",
  "version": "v04",
  "geometry": {
    "coordinates": [
      -59.88856,
      -7.20547,
      157
    ],
    "type": "Point"
  },
  "properties": {
    "data_id": "br-inmet/data/core/weather/surface-based-observations/synop/WIGOS_0-76-0-1300144000000406_20241019T020000",
    "datetime": "2024-10-19T02:00:00Z",
    "pubtime": "2024-10-19T02:14:03Z",
    "integrity": {
      "method": "sha512",
      "value": "o8y7a2CtqmMyYGsNUwfHKCyc/MZ2R1uqlFb06PH92pCJDZ3yAN22K5wCwJcXzGAtjdrcRvweXoRKV6l4rxLmew=="
    },
    "content": {
      "encoding": "base64",
      "value": "QlVGUgAA2wQAABYAACsAAAAAAAb/IQAH6AoTAgAAAAALAAABgMGWx1sAAK4AAATAAAMTMwMDE0NDAwMDAwMDQwNkuAAAQNo76gqCqkgAAAAAAAAAAAAAAAAAAAAC/RSYgD8qzpbo0QFcIK6I////////////////////////////////+AS3////////P////P/////////////////////////wD6P/xP7f///7+3///fE///7+3//4BLf/vif///////vif///+///////////j/////g3Nzc3",
      "size": 219
    },
    "wigos_station_identifier": "0-76-0-1300144000000406"
  },
  "links": [
    {
      "rel": "canonical",
      "type": "application/x-bufr",
      "href": "http://wis2bra.inmet.gov.br/data/2024-10-19/wis/br-inmet/data/core/weather/surface-based-observations/synop/WIGOS_0-76-0-1300144000000406_20241019T020000.bufr4",
      "length": 219
    },
    {
      "rel": "via",
      "type": "text/html",
      "href": "https://oscar.wmo.int/surface/#/search/station/stationReportDetails/0-76-0-1300144000000406"
    }
  ],
  "generated-by": "wis2box 1.0b7"
}

content has no attribute hash, but value instead

Suggested solution

integrity = job.get('payload', {}).get('properties', {}).get('integrity', {})
expected_hash = integrity.get('hash') or integrity.get('value')
@david-i-berry david-i-berry added the bug Something isn't working label Dec 4, 2024
david-i-berry added a commit that referenced this issue Dec 6, 2024
- #32 (http 200 check)
- #30 (integrity field)
- #27 (hash function)

Fixes path issues in Dockerfile.
david-i-berry added a commit that referenced this issue Dec 6, 2024
- #30 (integrity field)
- #27 (hash function)

Fixes path issues in Dockerfile.
@david-i-berry david-i-berry mentioned this issue Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants