Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: encode url for class details page. #98

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading