This week I was tasked in my Open source class to make a fix on the Brave Browser. We were able to pair up in partners to complete this task, in which I had partner up with my classmate Pranoy.
The bug we had to fix was that in other browsers accessing a file with a space automatically converts the space into URL encoded as shown below:
In Chrome Browser |
However in the Brave Browser the result happens:
In Brave Browser |
The way we fixed this bug was to add a trim onto the URL variable to remove any white spaces and convert it to the URL encoded white space.
let str = input.trim().replace(' ', '%20')
the result of this addition in the code was this:
in Brave Browser |
We had also added in some test cases:
+ 'it('seaches for dog cat instead of the link itself', function(){
+ assert.equal(urlUtil.isNotURL('https://www.google.ca/search?q=dog cat'), false)
+ })
+ it('seaches for dog cat instead of the link itself', function(){
+ assert.equal(urlUtil.isNotURL(' https://www.google.ca/search?q=dog cat '), false)
+ })
+ it('seaches for dog cat instead of the string itself', function(){
+ assert.equal(urlUtil.isNotURL('/home/pranoy/Desktop/dog cat.txt'), false)
+ })
+ it('seaches for dog cat instead of the string itself', function(){
+ assert.equal(urlUtil.isNotURL(' /home/pranoy/Desktop/dog cat.txt'), false)
+ })
Thank you for Reading,
Kevin
No comments:
Post a Comment