Update resolvedicon.jsx - test for custom color suffix

Changed if condition from string.match to string.test and expanded regex to also include upper case letters.
This commit is contained in:
Mega-Volti 2023-07-25 18:28:34 +02:00 committed by GitHub
parent 9a71c4de12
commit 8bdedfa4f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,7 +38,7 @@ export default function ResolvedIcon({ icon, width = 32, height = 32, alt = "log
if (prefix in iconSetURLs) {
// check whether icon ends with color code
if (!(suffix.match(`[#][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]`) == null)) {
if (suffix.test(`[#][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]`)) {
const iconColor = `${suffix}`;
const iconName = icon.replace(`${prefix}-`, "").replace(".svg", "").replace(`-${suffix}`, "");