Skip to content

Commit 0f7eae0

Browse files
committed
Ignroe only "shorter version" correctly while detecting multiple URIs in the selection #79
1 parent afb3d4a commit 0f7eae0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

webextensions/background/uriMatcher.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,10 @@ var URIMatcher = {
9797
const positionKey = `${range.startTextNodePos}:${range.startOffset}`;
9898
const longestResult = longestResultAt.get(positionKey);
9999
if (longestResult) {
100-
if (longestResult.text.length > maybeURI.original.length)
101-
continue;
102-
results.delete(longestResult);
100+
if (longestResult.text.length <= maybeURI.original.length &&
101+
maybeURI.original.startsWith(longestResult.text)) {
102+
results.delete(longestResult);
103+
}
103104
}
104105
const result = {
105106
text: maybeURI.original,

0 commit comments

Comments
 (0)