datalad / datalad-catalog

Create a user-friendly data catalog from structured metadata
https://datalad-catalog.netlify.app
MIT License
14 stars 12 forks source link

`logo_path` points to relative location to the dataset #462

Closed fraimondo closed 3 weeks ago

fraimondo commented 1 month ago

I'm trying to modify the logo following the instructions on the datalad handbook.

After creating a catalog using a custom config YAML file, I get the following in the config.json file:

    "logo_path": "artwork/catalog_cover.png",

However, this is how it appears:

Screenshot 2024-05-24 at 14 20 51

Digging around, the browser is doing a request to the following file, which gives a 404.

http://localhost:8000/dataset/1c32b2db-29a8-4280-b69b-bd839eec136f/artwork/catalog_cover.png

The file is correctly served if the request is done to http://localhost:8000/artwork/catalog_cover.png

jsheunis commented 1 month ago

Thanks for the report. Can you let me know what version of datalad-catalog you have? I will need to try and reproduce this.

fraimondo commented 1 month ago

I'm on the main dev branch from github. Needed to debug/patch this issues.

My workaround was to patch the json file (config.json) and add / at the beginning of the logo_path entry:

def fix_logo_path(catalog_path):
    """Fix the logo path."""
    config_json = catalog_path / "config.json"
    with config_json.open("r") as fin:
        config_data = json.load(fin)
    config_data["logo_path"] = f"/{config_data['logo_path']}"
    with config_json.open("w") as fout:
        json.dump(config_data, fout, indent=4)

I have quite some fixes/addons if you want them: e.g. add support for gitlab URL: Screenshot 2024-05-29 at 09 00 25

jsheunis commented 1 month ago

Fixes or addons are definitely welcome. For this specific issue, I'll need to incorporate it into a wider context related to this issue: https://github.com/datalad/datalad-catalog/issues/443

jsheunis commented 3 weeks ago

@fraimondo regarding

For this specific issue, I'll need to incorporate it into a wider context related to this issue https://github.com/datalad/datalad-catalog/issues/443

The changes in https://github.com/datalad/datalad-catalog/pull/478 have addressed that wider context, and should also address your reported issue. I tested it locally by creating a new catalog with a custom logo, and it all rendered as expected. I will close this issue, but please reopen if your problem isn't solved by these changes that are now in main