Skip to content

Commit

Permalink
FIX: Ensure HTTPS is used for bibtex url
Browse files Browse the repository at this point in the history
  • Loading branch information
mgxd committed Feb 26, 2024
1 parent 16b1612 commit 6bed295
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion templateflow/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,10 @@ def _to_bibtex(doi, template, idx):

# doi.org may not honor requested charset, to safeguard force a bytestream with
# response.content, then decode into UTF-8.
return response.content.decode()
bibtex = response.content.decode()

# doi.org / crossref may still point to the no longer preferred proxy service
return bibtex.replace('http://dx.doi.org/', 'https://doi.org/')


def _normalize_ext(value):
Expand Down
8 changes: 4 additions & 4 deletions templateflow/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def assert_same(self, other):
mni2009_fbib = """\
@article{Fonov_2011,
DOI={10.1016/j.neuroimage.2010.07.033},
url={http://dx.doi.org/10.1016/j.neuroimage.2010.07.033},
url={https://doi.org/10.1016/j.neuroimage.2010.07.033},
year={2011},
publisher={Elsevier BV},
ISSN={1053-8119},
Expand All @@ -99,7 +99,7 @@ def assert_same(self, other):
mni2009_lbib = """\
@inbook{Collins_1999,
DOI={10.1007/3-540-48714-x_16},
url={http://dx.doi.org/10.1007/3-540-48714-X_16},
url={https://doi.org/10.1007/3-540-48714-X_16},
year={1999},
publisher={Springer Berlin Heidelberg},
pages={210–223},
Expand All @@ -119,7 +119,7 @@ def assert_same(self, other):
@article{Van_Essen_2011,
DOI={10.1093/cercor/bhr291},
ISSN={1460-2199},
url={http://dx.doi.org/10.1093/cercor/bhr291},
url={https://doi.org/10.1093/cercor/bhr291},
year={2011},
publisher={Oxford University Press (OUP)},
volume={22},
Expand All @@ -139,7 +139,7 @@ def assert_same(self, other):
@article{Fischl_1999,
DOI={10.1002/(sici)1097-0193(1999)8:4<272::aid-hbm10>3.0.co;2-4},
ISSN={1097-0193},
url={http://dx.doi.org/10.1002/(sici)1097-0193(1999)8:4<272::aid-hbm10>3.0.co;2-4},
url={https://doi.org/10.1002/(sici)1097-0193(1999)8:4<272::aid-hbm10>3.0.co;2-4},
year={1999},
publisher={Wiley},
volume={8},
Expand Down

0 comments on commit 6bed295

Please sign in to comment.