Skip to content

Commit

Permalink
fix urls that are corrupted with a dash for the end line
Browse files Browse the repository at this point in the history
  • Loading branch information
lfoppiano committed Nov 13, 2024
1 parent 0c07bef commit e478c4f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,11 @@ public static List<OffsetPosition> characterPositionsUrlPatternWithPdfAnnotation
int destinationPos = 0;
if (urlString.replaceAll("\\s", "").equals(destination)) {
// Nothing to do here, we ignore the correctedLastTokenIndex because the regex got everything we need
} else if (destination.contains(urlString) || destination.contains(urlString.replaceAll("\\s", ""))) {
} else if (
destination.contains(urlString)
|| destination.contains(urlString.replaceAll("\\s", ""))
|| destination.contains(StringUtils.stripEnd(urlString, "-"))
) {
//In this case the regex did not catch all the URL, so we need to extend it using the
// destination URL from the annotation
destinationPos = destination.indexOf(urlString) + urlString.length();
Expand Down

0 comments on commit e478c4f

Please sign in to comment.