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

feature: implement basic querystring params validation (resolves #3055) #3393

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

qwerty541
Copy link
Collaborator

@qwerty541 qwerty541 commented Oct 19, 2023

This is basic implementation of querystring params validation for stats card. I think we should provide user-friendly errors in case if wrong param type was passed. Currently it shows something like str.split is not a function.

@rickstaa @anuraghazra Let me know what do you think about it. I will implement same for other cards if you approve this pull request.

Looks like it also almost does not affect on performance: 160ms before changes and 172ms after.

@qwerty541 qwerty541 added enhancement New feature or request. hacktoberfest-accepted javascript Pull requests that update Javascript code feature labels Oct 19, 2023
@qwerty541 qwerty541 self-assigned this Oct 19, 2023
@vercel
Copy link

vercel bot commented Oct 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
github-readme-stats ✅ Ready (Inspect) Visit Preview Dec 3, 2023 0:49am

@github-actions github-actions bot added the stats-card Feature, Enhancement, Fixes related to stats the stats card. label Oct 19, 2023
@qwerty541 qwerty541 linked an issue Oct 19, 2023 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Oct 19, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (80b2d23) 98.02% compared to head (d656449) 97.94%.

Files Patch % Lines
src/common/validate.js 93.75% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3393      +/-   ##
==========================================
- Coverage   98.02%   97.94%   -0.08%     
==========================================
  Files          27       28       +1     
  Lines        6267     6414     +147     
  Branches      549      570      +21     
==========================================
+ Hits         6143     6282     +139     
- Misses        121      129       +8     
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rickstaa
Copy link
Collaborator

rickstaa commented Oct 31, 2023

@qwerty541, I appreciate the pull request. I've asked @anuraghazra for a review, mainly because he recently commented on the rationale behind avoiding strict query parsing. You can find his insights here: #2761 (comment).

@rickstaa rickstaa removed their request for review October 31, 2023 15:41
Copy link
Collaborator Author

@qwerty541 qwerty541 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qwerty541, I appreciate the pull request. I've asked @anuraghazra for a review, mainly because he recently commented on the rationale behind avoiding strict query parsing. You can find his insights here: #2761 (comment).

@rickstaa It is the thing that i wanted to discuss about this pull request with you and @anuraghazra. As you see, currently e2e tests fails on this branch, it was because requested URL contains extra query parameter for bursting cache. I also remember that we recently removed count_private parameter and most likely a lot of people have not removed it from card URL. If the current strict check will be kept a lot of cards will be broken. I see two ways to solve it, first is reserving these query parameters, and second way is completely allowing to add extra parameters. I want to know which of them better in your opinion.

@rickstaa
Copy link
Collaborator

rickstaa commented Nov 1, 2023

@qwerty541, I appreciate the pull request. I've asked @anuraghazra for a review, mainly because he recently commented on the rationale behind avoiding strict query parsing. You can find his insights here: #2761 (comment).

@rickstaa It is the thing that i wanted to discuss about this pull request with you and @anuraghazra. As you see, currently e2e tests fails on this branch, it was because requested URL contains extra query parameter for bursting cache. I also remember that we recently removed count_private parameter and most likely a lot of people have not removed it from card URL. If the current strict check will be kept a lot of cards will be broken. I see two ways to solve it, first is reserving these query parameters, and second way is completely allowing to add extra parameters. I want to know which of them better in your opinion.

I would keep the current behavoir where we allow extra parameters, but let's see what @anuraghazra thinks 👍🏻.

@qwerty541
Copy link
Collaborator Author

qwerty541 commented Nov 25, 2023

@qwerty541, I appreciate the pull request. I've asked @anuraghazra for a review, mainly because he recently commented on the rationale behind avoiding strict query parsing. You can find his insights here: #2761 (comment).

@rickstaa It is the thing that i wanted to discuss about this pull request with you and @anuraghazra. As you see, currently e2e tests fails on this branch, it was because requested URL contains extra query parameter for bursting cache. I also remember that we recently removed count_private parameter and most likely a lot of people have not removed it from card URL. If the current strict check will be kept a lot of cards will be broken. I see two ways to solve it, first is reserving these query parameters, and second way is completely allowing to add extra parameters. I want to know which of them better in your opinion.

I would keep the current behavoir where we allow extra parameters, but let's see what @anuraghazra thinks 👍🏻.

After rethinking i came to the conclusion that there is no significant reasons to prohibit extra parameters. Are you up to approve this pull request for merging if i rework it this way?

@qwerty541
Copy link
Collaborator Author

@qwerty541, I appreciate the pull request. I've asked @anuraghazra for a review, mainly because he recently commented on the rationale behind avoiding strict query parsing. You can find his insights here: #2761 (comment).

@rickstaa It is the thing that i wanted to discuss about this pull request with you and @anuraghazra. As you see, currently e2e tests fails on this branch, it was because requested URL contains extra query parameter for bursting cache. I also remember that we recently removed count_private parameter and most likely a lot of people have not removed it from card URL. If the current strict check will be kept a lot of cards will be broken. I see two ways to solve it, first is reserving these query parameters, and second way is completely allowing to add extra parameters. I want to know which of them better in your opinion.

I would keep the current behavoir where we allow extra parameters, but let's see what @anuraghazra thinks 👍🏻.

After rethinking i came to the conclusion that there is no significant reasons to prohibit extra parameters. Are you up to approve this pull request for merging if i rework it this way?

@rickstaa I have update the code by covering changes with tests and allowing extra query string parameters. Check it please when you have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request. feature hacktoberfest-accepted javascript Pull requests that update Javascript code stats-card Feature, Enhancement, Fixes related to stats the stats card.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Odd error message when an URL parameter is passed multiple times
3 participants