Skip to content

Commit 8890ca6

Browse files
committed
fix. query validation
1 parent c21ee2f commit 8890ca6

4 files changed

Lines changed: 14 additions & 7 deletions

File tree

api/github-languages.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import fetch from "node-fetch";
22

33
export default async function handler(req, res) {
44
const { repo } = req.query;
5-
if (!repo) {
6-
return res.status(400).json({ error: "Missing repo query parameter" });
5+
if (!repo || typeof repo !== 'string' || !/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(repo)) {
6+
return res.status(400).json({ error: "Invalid or missing repo query parameter" });
77
}
88

99
const token = process.env.GITHUB_PAT || '';

notes/courses/MATH-UA-334/index.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,10 @@
4343
"slug": "09-method-of-moments",
4444
"title": "9 - Method of Moments",
4545
"date": "2026-02-18"
46+
},
47+
{
48+
"slug": "10-maximum-likelihood-estimation",
49+
"title": "10 - Maximum Likelihood Estimation",
50+
"date": "2026-02-23"
4651
}
4752
]

notes/js/note.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ fetch(`/notes/courses/${course}/${noteSlug}.md`)
6464
(_, num) => `<sup id="fnref${num}"><a href="#fn${num}">${num}</a></sup>`
6565
);
6666

67-
const back = document.getElementById("back-to-course");
68-
back.href = `course.html?id=${encodeURIComponent(course)}`;
67+
const back = document.querySelectorAll("#back-to-course, .back-link, .top-back-link");
68+
back.forEach(back => back.href = `course.html?id=${encodeURIComponent(course)}`);
6969

7070
const h1 = document.createElement("h1");
7171
h1.textContent = meta.title || noteSlug;

package-lock.json

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)