Skip to content

Commit 2ea7115

Browse files
committed
Standardise data URLs to virtualflybrain.org/data host
get_secure_data_v2_url now rewrites the www data host to the environment-independent https://virtualflybrain.org/data/ host (instead of https://v2.virtualflybrain.org/data/), matching the term-link permalink standardisation. Test expectations updated.
1 parent d48882b commit 2ea7115

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/test/term_info_queries_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,13 +487,13 @@ def test_term_info_serialization_template(self):
487487
self.assertTrue("filemeta" in serialized)
488488
self.assertEqual(3, len(serialized["filemeta"]))
489489
self.assertEqual({'obj': {'local': '/MeshFiles(OBJ)/my_id_(my_name).obj',
490-
'url': 'https://v2.virtualflybrain.org/data/VFB/i/0020/0000/VFB_00200000/volume_man.obj'}},
490+
'url': 'https://virtualflybrain.org/data/VFB/i/0020/0000/VFB_00200000/volume_man.obj'}},
491491
serialized["filemeta"][0])
492492
self.assertEqual({'wlz': {'local': '/Slices(WOOLZ)/my_id_(my_name).wlz',
493-
'url': 'https://v2.virtualflybrain.org/data/VFB/i/0020/0000/VFB_00200000/volume.wlz'}},
493+
'url': 'https://virtualflybrain.org/data/VFB/i/0020/0000/VFB_00200000/volume.wlz'}},
494494
serialized["filemeta"][1])
495495
self.assertEqual({'nrrd': {'local': '/SignalFiles(NRRD)/my_id_(my_name).nrrd',
496-
'url': 'https://v2.virtualflybrain.org/data/VFB/i/0020/0000/VFB_00200000/volume.nrrd'}},
496+
'url': 'https://virtualflybrain.org/data/VFB/i/0020/0000/VFB_00200000/volume.nrrd'}},
497497
serialized["filemeta"][2])
498498
self.assertTrue("template" in serialized)
499499
self.assertEqual("[JRC2018UnisexVNC](VFB_00200000)", serialized["template"])

src/vfbquery/term_info_queries.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,12 +1069,14 @@ def get_secure_data_url(data_url: str) -> str:
10691069

10701070
def get_secure_data_v2_url(data_url: str) -> str:
10711071
"""
1072-
Generates a secure data v2 url from the given url
1072+
Generates a secure, canonical data url from the given url: forces https and
1073+
rewrites the www data host to the environment-independent virtualflybrain.org
1074+
host, consistent with VFB term permalinks.
10731075
:param data_url: data url to secure
1074-
:return: secured v2 url
1076+
:return: secured data url
10751077
"""
10761078
return data_url.replace("http://", "https://").replace("https://www.virtualflybrain.org/data/",
1077-
"https://v2.virtualflybrain.org/data/")
1079+
"https://virtualflybrain.org/data/")
10781080

10791081

10801082
def serialize_term_info_to_json(vfb_term: VfbTerminfo, show_types=False) -> str:

0 commit comments

Comments
 (0)