Skip to content

Commit

Permalink
Fix DOI and URL parsing regression when the last character is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtcode committed Nov 13, 2024
1 parent 80dd982 commit 820effc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/module/link/parsed-overlays.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function getParsedOverlays(chars) {
let match = text.match(urlRegExp);
if (match) {
let from = sequence.from + match.index;
let to = from + match[0].length - 1;
let to = from + match[0].length;
let url = chars.slice(from, to).map(x => x.c).join('');
if (url.includes('@')) {
continue;
Expand All @@ -63,7 +63,7 @@ export function getParsedOverlays(chars) {
match = text.match(doiRegExp);
if (match) {
let from = sequence.from + match.index;
let to = from + match[0].length - 1;
let to = from + match[0].length;
let doi = chars.slice(from, to).map(x => x.c).join('');
let url = 'https://doi.org/' + encodeURIComponent(doi);
links.push({ from, to, text: doi, url });
Expand Down

0 comments on commit 820effc

Please sign in to comment.