Skip to content

Commit

Permalink
fixing CodeQL security issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TeaByte committed Feb 15, 2024
1 parent 82f3802 commit 8102b92
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions islands/ProgressCheck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import IconCircleCheckFilled from "https://deno.land/x/[email protected]/ts
import IconCircle from "https://deno.land/x/[email protected]/tsx/circle.tsx";
import { useEffect, useState } from "preact/hooks";
import { newPassSignal } from "./signals/store.ts";
export default function ProgressCheck(props: {slug : string}) {
export default function ProgressCheck(props: { slug: string }) {
const [isPassed, setIsPassed] = useState<boolean>(false);
useEffect(() => {
const passedTEXT = localStorage.getItem("passedCourses");
let passed: string[] = [];
if (passedTEXT) {
passed = JSON.parse(passedTEXT);
}
if (passed.includes(props.slug.replace("\\", "/"))) {
if (passed.includes(props.slug.replace(/\\/g, "/"))) {
setIsPassed(true);
}
}, [newPassSignal.value]);
return isPassed
? <IconCircleCheckFilled aria-hidden="true" class="h-4 w-4" />
: <IconCircle aria-hidden="true" class="h-4 w-4" />;
? <IconCircleCheckFilled aria-hidden="true" class="h-4 w-4" />
: <IconCircle aria-hidden="true" class="h-4 w-4" />;
}
4 changes: 2 additions & 2 deletions utils/course.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ export function getFlatSlugs() {
const slugs = courses.map((c) => {
if ("courses" in c) {
c.courses.sort((a, b) => a.order - b.order);
return c.courses.map((c) => c.slug.replace("\\", "/"));
return c.courses.map((c) => c.slug.replace(/\\/g, "/"));
}
return c.slug.replace("\\", "/");
return c.slug.replace(/\\/g, "/");
});
const FlatSlugs = slugs.flat();
FlatSlugsCache = FlatSlugs;
Expand Down

0 comments on commit 8102b92

Please sign in to comment.