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

Add search query conditions #4557

Merged
merged 1 commit into from
Oct 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/lib/urlutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ const UrlUtil = {
const caseDomain = /^[\w]{2,5}:\/\/[^\s\/]+\//
// for cases, quoted strings
const case1Reg = /^".*"$/
// for cases, ?abc and "a? b" which should searching query
const case2Reg = /^(\?)|(\?.+\s)/
// for cases, ?abc, "a? b", ".abc" and "abc." which should searching query
const case2Reg = /^(\?)|(\?.+\s)|^(\.)|(\.)$/
// for cases, pure string
const case3Reg = /[\?\.\/\s:]/
// for cases, data:uri, view-source:uri and about
Expand Down
6 changes: 6 additions & 0 deletions test/unit/lib/urlutilTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ describe('urlutil', function () {
it('returns true when input has a question mark followed by a space', function () {
assert.equal(UrlUtil.isNotURL('? brave'), true)
})
it('returns true when input starts with .', function () {
assert.equal(UrlUtil.isNotURL('.brave'), true)
})
it('returns true when input end with .', function () {
assert.equal(UrlUtil.isNotURL('brave.'), true)
})
})
it('returns false when input is a valid URL', function () {
assert.equal(UrlUtil.isNotURL('brave.com'), false)
Expand Down