Skip to content

Commit

Permalink
Add check that id exists in standardizeId (#159)
Browse files Browse the repository at this point in the history
Co-authored-by: xavilien <“[email protected]”>
  • Loading branch information
Xavilien and xavilien authored Aug 16, 2024
1 parent 3984a4e commit 3e30c26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/src/app/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import namecase from "namecase";
export const courseIdRegex = /([0-9]{2}-?[0-9]{3})/g;

export const standardizeId = (id: string) => {
if (!id.includes("-") && id.length >= 5) {
if (id && !id.includes("-") && id.length >= 5) {
return id.slice(0, 2) + "-" + id.slice(2);
}

Expand Down

0 comments on commit 3e30c26

Please sign in to comment.