Skip to content

Commit 6bed295

Browse files
committed
FIX: Ensure HTTPS is used for bibtex url
1 parent 16b1612 commit 6bed295

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

templateflow/api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,10 @@ def _to_bibtex(doi, template, idx):
335335

336336
# doi.org may not honor requested charset, to safeguard force a bytestream with
337337
# response.content, then decode into UTF-8.
338-
return response.content.decode()
338+
bibtex = response.content.decode()
339+
340+
# doi.org / crossref may still point to the no longer preferred proxy service
341+
return bibtex.replace('http://dx.doi.org/', 'https://doi.org/')
339342

340343

341344
def _normalize_ext(value):

templateflow/tests/test_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def assert_same(self, other):
8383
mni2009_fbib = """\
8484
@article{Fonov_2011,
8585
DOI={10.1016/j.neuroimage.2010.07.033},
86-
url={http://dx.doi.org/10.1016/j.neuroimage.2010.07.033},
86+
url={https://doi.org/10.1016/j.neuroimage.2010.07.033},
8787
year={2011},
8888
publisher={Elsevier BV},
8989
ISSN={1053-8119},
@@ -99,7 +99,7 @@ def assert_same(self, other):
9999
mni2009_lbib = """\
100100
@inbook{Collins_1999,
101101
DOI={10.1007/3-540-48714-x_16},
102-
url={http://dx.doi.org/10.1007/3-540-48714-X_16},
102+
url={https://doi.org/10.1007/3-540-48714-X_16},
103103
year={1999},
104104
publisher={Springer Berlin Heidelberg},
105105
pages={210–223},
@@ -119,7 +119,7 @@ def assert_same(self, other):
119119
@article{Van_Essen_2011,
120120
DOI={10.1093/cercor/bhr291},
121121
ISSN={1460-2199},
122-
url={http://dx.doi.org/10.1093/cercor/bhr291},
122+
url={https://doi.org/10.1093/cercor/bhr291},
123123
year={2011},
124124
publisher={Oxford University Press (OUP)},
125125
volume={22},
@@ -139,7 +139,7 @@ def assert_same(self, other):
139139
@article{Fischl_1999,
140140
DOI={10.1002/(sici)1097-0193(1999)8:4<272::aid-hbm10>3.0.co;2-4},
141141
ISSN={1097-0193},
142-
url={http://dx.doi.org/10.1002/(sici)1097-0193(1999)8:4<272::aid-hbm10>3.0.co;2-4},
142+
url={https://doi.org/10.1002/(sici)1097-0193(1999)8:4<272::aid-hbm10>3.0.co;2-4},
143143
year={1999},
144144
publisher={Wiley},
145145
volume={8},

0 commit comments

Comments
 (0)