Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Fixes invalid url error #13722

Merged
merged 1 commit into from
Apr 18, 2018
Merged

Fixes invalid url error #13722

merged 1 commit into from
Apr 18, 2018

Conversation

NejcZdovc
Copy link
Contributor

@NejcZdovc NejcZdovc commented Apr 4, 2018

Resolves #12826

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.
  • Request a security/privacy review as needed. (Ask a Brave employee to help if you cannot access this document.)

Test Plan:

Reviewer Checklist:

  • Request a security/privacy review as needed if one was not already requested.

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@codecov-io
Copy link

codecov-io commented Apr 4, 2018

Codecov Report

Merging #13722 into master will decrease coverage by <.01%.
The diff coverage is 0%.

@@            Coverage Diff             @@
##           master   #13722      +/-   ##
==========================================
- Coverage   56.52%   56.52%   -0.01%     
==========================================
  Files         283      283              
  Lines       28817    28819       +2     
  Branches     4777     4778       +1     
==========================================
  Hits        16289    16289              
- Misses      12528    12530       +2
Flag Coverage Δ
#unittest 56.52% <0%> (-0.01%) ⬇️
Impacted Files Coverage Δ
js/lib/request.js 36.76% <0%> (-1.12%) ⬇️

@@ -49,8 +49,15 @@ module.exports.request = (options, callback) => {
})
}

let urlParsed = null
try {
urlParsed = urlParse(options.url)
Copy link
Member

Choose a reason for hiding this comment

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

are you sure this fixes the crash? muon.url.parse doesn't throw an error for most invalid URLs:

screen shot 2018-04-09 at 12 50 46 pm

if the crash is because the URL is undefined, you could just replace this check with if (typeof options.url !== 'string') { return callback(new Error('URL is not valid')) }. then we wouldn't need to do url.parse on the URL unless we are in development mode (https://github.com/brave/browser-laptop/pull/13722/files#diff-2565914e73f517d565765ef02f30d306R59)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@NejcZdovc NejcZdovc requested a review from diracdeltas April 16, 2018 10:18
@NejcZdovc
Copy link
Contributor Author

@diracdeltas can you please re-review

Resolves brave#12826

Auditors:

Test Plan:
Copy link
Member

@diracdeltas diracdeltas left a comment

Choose a reason for hiding this comment

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

lgtm

@NejcZdovc NejcZdovc modified the milestones: Completed work, 0.22.x Release 3 (Beta channel) Apr 17, 2018
@NejcZdovc NejcZdovc merged commit 1ec3da9 into brave:master Apr 18, 2018
NejcZdovc added a commit that referenced this pull request Apr 18, 2018
NejcZdovc added a commit that referenced this pull request Apr 18, 2018
@NejcZdovc
Copy link
Contributor Author

master 1ec3da9
0.23 a268969
0.22 593cae3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants