fix: remove unnecessary escape characters in regex patterns
移除了正则表达式中不必要的转义字符: - users.ts: 修复 5 个 \/ 不必要的转义 - TabContext.tsx: 修复 1 个 \/ 不必要的转义 在字符串形式的正则表达式中,/ 不需要转义。
This commit is contained in:
@@ -34,14 +34,14 @@ async function verifyOIDCToken(
|
|||||||
const possibleIssuers = [
|
const possibleIssuers = [
|
||||||
issuerUrl,
|
issuerUrl,
|
||||||
normalizedIssuerUrl,
|
normalizedIssuerUrl,
|
||||||
issuerUrl.replace(/\/application\/o\/[^\/]+$/, ""),
|
issuerUrl.replace(/\/application\/o\/[^/]+$/, ""),
|
||||||
normalizedIssuerUrl.replace(/\/application\/o\/[^\/]+$/, ""),
|
normalizedIssuerUrl.replace(/\/application\/o\/[^/]+$/, ""),
|
||||||
];
|
];
|
||||||
|
|
||||||
const jwksUrls = [
|
const jwksUrls = [
|
||||||
`${normalizedIssuerUrl}/.well-known/jwks.json`,
|
`${normalizedIssuerUrl}/.well-known/jwks.json`,
|
||||||
`${normalizedIssuerUrl}/jwks/`,
|
`${normalizedIssuerUrl}/jwks/`,
|
||||||
`${normalizedIssuerUrl.replace(/\/application\/o\/[^\/]+$/, "")}/.well-known/jwks.json`,
|
`${normalizedIssuerUrl.replace(/\/application\/o\/[^/]+$/, "")}/.well-known/jwks.json`,
|
||||||
];
|
];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -491,7 +491,7 @@ router.get("/oidc/authorize", async (req, res) => {
|
|||||||
|
|
||||||
let origin =
|
let origin =
|
||||||
req.get("Origin") ||
|
req.get("Origin") ||
|
||||||
req.get("Referer")?.replace(/\/[^\/]*$/, "") ||
|
req.get("Referer")?.replace(/\/[^/]*$/, "") ||
|
||||||
"http://localhost:5173";
|
"http://localhost:5173";
|
||||||
|
|
||||||
if (origin.includes("localhost")) {
|
if (origin.includes("localhost")) {
|
||||||
@@ -598,10 +598,7 @@ router.get("/oidc/callback", async (req, res) => {
|
|||||||
const normalizedIssuerUrl = config.issuer_url.endsWith("/")
|
const normalizedIssuerUrl = config.issuer_url.endsWith("/")
|
||||||
? config.issuer_url.slice(0, -1)
|
? config.issuer_url.slice(0, -1)
|
||||||
: config.issuer_url;
|
: config.issuer_url;
|
||||||
const baseUrl = normalizedIssuerUrl.replace(
|
const baseUrl = normalizedIssuerUrl.replace(/\/application\/o\/[^/]+$/, "");
|
||||||
/\/application\/o\/[^\/]+$/,
|
|
||||||
"",
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const discoveryUrl = `${normalizedIssuerUrl}/.well-known/openid-configuration`;
|
const discoveryUrl = `${normalizedIssuerUrl}/.well-known/openid-configuration`;
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export function TabProvider({ children }: TabProviderProps) {
|
|||||||
}
|
}
|
||||||
const m = t.title.match(
|
const m = t.title.match(
|
||||||
new RegExp(
|
new RegExp(
|
||||||
`^${root.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&")} \\((\\d+)\\)$`,
|
`^${root.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")} \\((\\d+)\\)$`,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (m) {
|
if (m) {
|
||||||
|
|||||||
Reference in New Issue
Block a user