-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: handle upper case protocol like HTTP or HTTPS #1805
Conversation
fix pull 1804 when url like HTTP or HTTPS
fix pull 1804 when url like HTTP or HTTPS
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1805 +/- ##
=======================================
Coverage 98.66% 98.66%
=======================================
Files 5 5
Lines 525 525
Branches 147 147
=======================================
Hits 518 518
Misses 7 7 ☔ View full report in Codecov by Sentry. |
@@ -266,7 +266,7 @@ module.exports = { | |||
redirect (url, alt) { | |||
// location | |||
if (url === 'back') url = this.ctx.get('Referrer') || alt || '/' | |||
if (url.startsWith('https://') || url.startsWith('http://')) { | |||
if (/^https?:\/\//i.test(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.
@FDrag0n I change to use Regex to avoid lowerCase twice.
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.
It's a nice change👍
Co-authored-by: fengmk2 <suqian.yf@antgroup.com>
pick from #1805 Co-authored-by: FDrag0n <34733637+FDrag0n@users.noreply.github.com>
Co-authored-by: fengmk2 <suqian.yf@antgroup.com>
#1800 's fix #1804 forgot to consider the case where url is uppercase HTTP and HTTPS