Skip to content

Commit

Permalink
fix: encode url for class details page.
Browse files Browse the repository at this point in the history
  • Loading branch information
anfbermudezme committed Jun 27, 2024
1 parent 34943ad commit 036e430
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/features/Classes/Class/ClassPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const ClassPage = () => {
<Button onClick={() => history.goBack()} className="mr-3 link back-arrow" variant="tertiary">
<i className="fa-solid fa-arrow-left" />
</Button>
<h3 className="h2 mb-0 course-title">Class details: {classId}</h3>
<h3 className="h2 mb-0 course-title">Class details: {decodeURIComponent(classId)}</h3>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/features/Classes/InstructorCard/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const InstructorCard = () => {
<article className="instructor-wrapper mb-4 d-flex flex-column flex-sm-row justify-content-between align-items-start">
<div className="d-flex flex-column w-75 justify-content-between h-100">
<h3 className="text-color text-uppercase font-weight-bold text-truncate w-75" title={classId}>
{classId}
{decodeURIComponent(classId)}
</h3>
{isLoadingClasses && (
<div className="w-100 h-100 d-flex justify-content-center align-items-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('columns', () => {
const linkElement = screen.getByText('Class example');
expect(linkElement).toBeInTheDocument();
expect(linkElement).toHaveClass('text-truncate link');
expect(linkElement).toHaveAttribute('href', '/courses/Demo Course 1/Class example?classId=class id&previous=courses');
expect(linkElement).toHaveAttribute('href', '/courses/Demo Course 1/Class example?classId=class%20id&previous=courses');
});

test('Should render the dates', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/features/Courses/CourseDetailTable/columns.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const columns = [
const { courseId } = useParams();
return (
<Link
to={`/courses/${courseId}/${row.values.className}?classId=${row.original.classId}&previous=courses`}
to={`/courses/${courseId}/${encodeURIComponent(row.values.className)}?classId=${encodeURIComponent(row.original.classId)}&previous=courses`}
className="text-truncate link"
>
{row.values.className}
Expand Down

0 comments on commit 036e430

Please sign in to comment.