-
-
Notifications
You must be signed in to change notification settings - Fork 179
fix: URL-encode programming language filter values in resource list #2079
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
Changes from all commits
2d7cedb
c070d39
5b2f22d
5c2f962
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,7 +54,7 @@ | |
| <a href="?extension={{ resource.extension }}" class="is-black-link">{{ resource.extension }}</a> | ||
| </td> | ||
| <td class="break-all"> | ||
| <a href="?programming_language={{ resource.programming_language }}" class="is-black-link">{{ resource.programming_language }}</a> | ||
| <a href="?programming_language={{ resource.programming_language|urlencode }}" class="is-black-link">{{ resource.programming_language }}</a> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a unit test in |
||
| </td> | ||
| <td class="break-all"> | ||
| <a href="?mime_type={{ resource.mime_type }}" class="is-black-link">{{ resource.mime_type }}</a> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -788,6 +788,18 @@ def test_scanpipe_api_project_action_resources_filterset(self): | |
| response = self.csrf_client.get(url + "?slug=aaa") | ||
| self.assertEqual(2, response.data["count"]) | ||
|
|
||
| def test_scanpipe_api_project_action_resources_filterset_special_chars(self): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test is unrelated to the PR changes. What's the reasoning behind testing the API in place of testing your code changes?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i was just confirming whether or not special characters are correctly handled in the api. so, thought of adding a test for it.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's fine let's keep it. I was just wondering about your intent since the actual changes were not tested. |
||
| make_resource_file( | ||
| self.project1, | ||
| path="csharp_file.cs", | ||
| programming_language="C#", | ||
| ) | ||
| url = reverse("project-resources", args=[self.project1.uuid]) | ||
| response = self.csrf_client.get(url + "?programming_language=C%23") | ||
| self.assertEqual(1, response.data["count"]) | ||
| self.assertEqual("csharp_file.cs", response.data["results"][0]["path"]) | ||
| self.assertEqual("C#", response.data["results"][0]["programming_language"]) | ||
|
|
||
| def test_scanpipe_api_project_action_packages(self): | ||
| url = reverse("project-packages", args=[self.project1.uuid]) | ||
| response = self.csrf_client.get(url) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a unit test in
ScanPipeViewsTestto make sure the values are properly encoded in the rendered HTML.