diff --git a/cellxgene_gateway/filecrawl.py b/cellxgene_gateway/filecrawl.py index cf0b443..1001276 100644 --- a/cellxgene_gateway/filecrawl.py +++ b/cellxgene_gateway/filecrawl.py @@ -14,6 +14,7 @@ from cellxgene_gateway.dir_util import ( make_annotations, annotations_suffix, ) +from flask import url_for def recurse_dir(path): @@ -44,13 +45,10 @@ def recurse_dir(path): "name": x[:-13] if (len(x) > 13 and x[-13] in ["-", "_"]) else (x[:-4] if x.endswith(".csv") else x), - "path": os.path.join(full_path, x).replace( - env.cellxgene_data, "" - ), + "path": os.path.join(full_path, x).replace(env.cellxgene_data, ""), } for x in sorted(os.listdir(full_path)) - if x.endswith(".csv") - and os.path.isfile(os.path.join(full_path, x)) + if x.endswith(".csv") and os.path.isfile(os.path.join(full_path, x)) ] return [ { @@ -91,7 +89,7 @@ def render_entries(entries): def get_url(entry): - return f"/view/{ entry['path'].lstrip('/') }/" + return url_for("do_view", entry) def get_class(entry): diff --git a/cellxgene_gateway/templates/index.html b/cellxgene_gateway/templates/index.html index 3d95124..250dd58 100644 --- a/cellxgene_gateway/templates/index.html +++ b/cellxgene_gateway/templates/index.html @@ -35,12 +35,12 @@ Links: