Skip to content

Commit d9c99e5

Browse files
committed
refactor: compare origins instead of regexp match
1 parent 9756254 commit d9c99e5

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

src/WebViewShared.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,7 @@ const isDownloadMessageAllowed = ({
8787
return false;
8888
}
8989

90-
const matchingRule = downloadWhitelist.find(rule => {
91-
const ruleOriginRegex = stringWhitelistToRegex(rule.origin);
92-
93-
return ruleOriginRegex.test(origin) && rule.allowedFileExtensions.includes(fileExtension);
94-
});
95-
96-
return Boolean(matchingRule);
90+
return Boolean(downloadWhitelist.find((rule) => rule.origin === origin && rule.allowedFileExtensions.includes(fileExtension)));
9791
};
9892

9993
const urlToProtocolScheme = (url: string): string | null => {

0 commit comments

Comments
 (0)