Skip to content

Commit

Permalink
clean up regex
Browse files Browse the repository at this point in the history
  • Loading branch information
AydanPirani committed Apr 14, 2024
1 parent 70a62e5 commit 207642a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/middleware/cors-middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import cors from "cors";

// Allow CORS for Netlify deploy previews
const allowedOrigins = ["https://reflectionsprojections.org"];

// Function to check if the origin matches the deploy preview format
function isNetlifyDeployPreview(origin: string) {
const regex = /^https:\/\/deploy-preview-\d+--rp2024\.netlify\.app\/$/;
const regex = new RegExp("deploy-preview-[0-9]*(--rp2024\.netlify\.app)(.*)")

Check failure on line 7 in src/middleware/cors-middleware.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `\.netlify\.app)(.*)")` with `.netlify.app)(.*)");`

Check failure on line 7 in src/middleware/cors-middleware.ts

View workflow job for this annotation

GitHub Actions / lint

Unnecessary escape character: \.

Check failure on line 7 in src/middleware/cors-middleware.ts

View workflow job for this annotation

GitHub Actions / lint

Unnecessary escape character: \.
return regex.test(origin);
}

Expand Down

0 comments on commit 207642a

Please sign in to comment.