Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

fix: url format should not allow ftp #6

Merged
merged 1 commit into from
Apr 22, 2017
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
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = function(json, options) {
unknownFormats: true,
errorDataPath: 'property',
formats: {
'http-url': str => validateUrl(str, true),
'https-url': str => validateUrl(str),
'relative-path': relativePath,
},
Expand Down
6 changes: 3 additions & 3 deletions manifest-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@
"ja": {
"type": "string",
"minLength": 1,
"format": "url"
"format": "http-url"
},
"en": {
"type": "string",
"minLength": 1,
"format": "url"
"format": "http-url"
},
"zh": {
"type": "string",
"minLength": 1,
"format": "url"
"format": "http-url"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ describe('validator', () => {
assert(actual.errors.length === 2);
});

it('relative path is invalid for `url`', () => {
it('relative path is invalid for `http-url`', () => {
const actual = validator(json({homepage_url: {en: 'foo/bar.html'}}));
assert(actual.valid === false);
assert(actual.errors.length === 1);
assert(actual.errors[0].params.format === 'url');
assert(actual.errors[0].params.format === 'http-url');
});

it('"http:" is invalid for `https-url`', () => {
Expand Down