mystmd icon indicating copy to clipboard operation
mystmd copied to clipboard

Non-DOI links to `https://doi.org` trigger obscure error

Open agoose77 opened this issue 1 year ago • 2 comments

Description

A simple link to https://doi.org, e.g. [DOI](http://www.doi.org/index.html) causes the MyST build to crash with an obscure

This format is not supported or recognized

error.

Proposed solution

Only treat the link as a DOI if it matches r"https:\/\/doi\.org\/10\.\d+\/.*"

agoose77 avatar Jan 08 '24 14:01 agoose77

One thing to keep in mind is that there is the short-doi service, where dois don't follow the normal rules but are still valid:

For example: https://doi.org/cr3qwn https://doi.org/10.1175/1520-0493(1972)100<0081:OTAOSH>2.3.CO;2 (which is a terrible URL, but is real)

This was introduced here where we now no longer validate a DOI URL after it is recognized: https://github.com/executablebooks/mystmd/pull/735

I think we can treat this as a new error, and treat non-resolving DOIs in the transform a bit better.

rowanc1 avatar Jan 30 '24 05:01 rowanc1

No longer crashes, and has a better error message:

⛔️ page.md:63 Citation data from doi.org was not available or malformed for doi:index.html
   To resolve this error, visit https://doi.org/index.html and add citation info to local BibTeX file

rowanc1 avatar Mar 04 '25 17:03 rowanc1