I'm trying to include a link to some code on OneDrive; the link includes an underscore, which is causing a lot of trouble.
I tried adding the entry like this:
@misc{code,
title = {Code},
url = {https://1drv.ms/link_link}
}
I use \usepackage{url} and \bibliographystyle{IEEEtran}. Everything compiles fine and the bibliography shows the correct entry. However, if you click the link, it opens a page at https://1drv.ms/link - so ignoring the underscore and everything after it, which leads to a wrong page.
Even copy and paste from the PDF doesn't work since the underscore is copied as space, which again is a broken link.
How can I add the link such that it can be clicked and copied properly? I tried \_, \usepackage{underscore}, {{link}}, different bibtex entries but nothing worked. Also all the related questions/answers don't answer mine.

\urlcommand to the bib. – Ulrike Fischer Jul 28 '17 at 11:42\usepackage{hyperref}fixed it! However, I did not need\urleven using bibtex; it seems like theurlfield in misc directly expects a URL. – stefanbschneider Jul 28 '17 at 12:11