GeoNodeUserGroup-DE / geonode-dev-datapackage

Datapackage development setup based on Docker Blueprint for GeoNode
0 stars 0 forks source link

Tabular datasets do not include a `download_url` #16

Closed ridoo closed 5 months ago

ridoo commented 5 months ago

See https://github.com/GeoNodeUserGroup-DE/geonode-dev-datapackage/issues/4

DatasetDownloadHandler: download_url()

ridoo commented 5 months ago

Adding tabular to DatasetDownloadHandler: download_url() will add proper links to /datasets response:

"download_urls": [
    {
        "url": "/datasets/geonode:horizon_data/dataset_download",
        "ajax_safe": true,
        "default": true
    }
]

However, the download link responds with:

{
    "error": "NoApplicableCode: Process failed during execution\norg.geotools.process.ProcessException: Don't know how to encode in mime type image/tiff\nDon't know how to encode in mime type image/tiff"
}
ridoo commented 5 months ago

More testing reveals that there's both download_urls (plural) and download_url (singular). Not sure why this is the case. However, the current fix only considered the plural case:

https://development.demo.geonode.org/api/v2/datasets?exclude[]=*&include[]=download_url&include[]=download_urls

{
    "links": {
        "next": null,
        "previous": null
    },
    "total": 2,
    "page": 1,
    "page_size": 10,
    "datasets": [
        {
            "download_urls": [
                {
                    "url": "/datasets/geonode:horizon_data/dataset_download",
                    "ajax_safe": true,
                    "default": true
                }
            ],
            "download_url": null
        },
        {
            "download_urls": [
                {
                    "url": "/datasets/geonode:laboratory_data/dataset_download",
                    "ajax_safe": true,
                    "default": true
                }
            ],
            "download_url": null
        }
    ]
}

The single case has to be fixed to, of course.

ridoo commented 5 months ago

Fixed