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 script_name without / at beginning #1835
base: main
Are you sure you want to change the base?
Conversation
Hey @abtinmo, thanks for the PR! Please add a test for this change. And make sure the CI is green. |
Codecov Report
@@ Coverage Diff @@
## master #1835 +/- ##
=========================================
- Coverage 81.21% 78.31% -2.9%
=========================================
Files 104 104
Lines 13625 13264 -361
=========================================
- Hits 11065 10388 -677
- Misses 2560 2876 +316 |
@abtinmo don't worry Circle CI and that flaky test. Just add a test case for your change. |
@webknjaz its done. |
This change feels dangerous so I would also require a clear approval from @jaraco, not just myself. |
cherrypy.log.error( | ||
msg='script_name {0} should start with /'.format(script_name) | ||
) | ||
script_name = '/' + script_name |
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.
I'm disinclined to continue to let the user supply an erroneous value and correct it for them. Why not instead hard-fail (raise an exception) when invalid values are input (similar to how script_name=None
is handled)?
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.
fixes the script_name to prevent 404 error (not sure if it's necessary) , its what i said in my first comment.
i don't think letting user to continue is a right solution. but in doc i saw this:
This should start with a slash
so i choose to fix error myself and throw a console error.
raise an exception is indeed a better solution
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.
AFAIR we discussed raising an exception for the invalid input. I'll wait for this change before attempting to review again.
What kind of change does this PR introduce?
What is the related issue number (starting with
#
)#1772
What is the current behavior? (You can also link to an open issue here)
#1772
What is the new behavior (if this is a feature change)?
shows an error, telling: script_name foo should start with /
fixes the script_name to prevent 404 error (not sure if it's necessary)
Other information:
Checklist:
and description in grammatically correct, complete sentences