Git Product home page Git Product logo

valid-url's People

Contributors

christianmurphy avatar eugenelim avatar jp26jp avatar mykolaprymak avatar ogt avatar sagens42 avatar tobli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

valid-url's Issues

Validation error

Your input url is :https:::///wwww.google.com
Looks like an valid URI

Double slash in url

I have an issue to validating the URL
For an example
var url = "http://localhost:4001//app**//**test#//dash//Dashboard1"

if (validUrl.isUri(url)){
    console.log('Looks like an URI');
} else {
    console.log('Not a URI');
}

The output says valid url but I want to validate the double slash also.
Some of my customers makes mistakes to give the url input so its redirects to some other pages.

False positives

var validator = require('valid-url');
console.log( validator.isWebUri('http://foo') );

prints http://foo (e.g. true), which is not correct. There is no TLD. Valid URLs will have at least one dot and 1 character after the dot.

Replicate the functionality of Data-Validate-URI perl module

Replicates the functionality of http://search.cpan.org/~sonnen/Data-Validate-URI-0.01/lib/Data/Validate/URI.pm
(http://anonscm.debian.org/gitweb/?p=users/dom/libdata-validate-uri-perl.git )
into a nodejs module.

The module (named valid-url)

  • includes the main code into ./index.js (without the pod (embedded perl doc stuff) text )
  • includes the documentation into the readme
  • includes the tests under test/*.js
  • exports the same functions
  • passes travis test - which enforces test passing + jshint passing based on the included .jshintrc

sourced@oDesk for $75 : https://www.odesk.com/jobs/~~40efa52e915abd59

  • Budget : $75
  • Required Skills : node.js, javascript
  • Question : Should one add in the package.json dependencies modules that are required exclusively by the tests?

is_iri should allow UTF-8 characters

Currently is_iri fails on any characters, which don't match this regex:

if (/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(value)) return;

Example:

t.ok(is_uri('http://localhost/ä'), 'http://localhost/ä');

As far as I understand the main difference between URI and IRI is:

IRIs extend URIs by using the Universal Character Set, where URIs were limited to ASCII, with far fewer characters.

https://en.wikipedia.org/wiki/Internationalized_Resource_Identifier

Therefore is_iri should allow all UTF-8 characters and these exports aren't correct:

module.exports.is_uri = is_iri;
module.exports.isUri = is_iri;

Instead there should be two exports: is_iri and is_uri.

I saw there wasn't any commit to this repo since 2015, but since this affects a Gatsby issue I was wondering, what you plans with the module are? Do you think about handing it over, @ogt?

The module is used heavily according to npms download numbers, so it might be in the interest of the community to give it some 💌 .

Additional test cases

https://gist.github.com/mxpv/034933deeebb26b62f14

Was running the above through valid-url and here are the ones that failed when they should have succeeded:

http://✪df.ws/123
http://➡.ws/䨹
http://⌘.ws
http://⌘.ws/
http://foo.com/unicode_(✪)_in_parens
http://☺.damowmow.com/
http://مثال.إختبار
http://例子.测试
http://उदाहरण.परीक्षा

URIs starting with //

isUri returns undefined for urls starting with a double slash, as in //lh6.ggpht.com/5mI27oolnooL__S3ns9qAf_6TsFNExMtUAwTKz6prWCxEmVkmZZZwe3lI-ZLbMawEJh3=w300 which I understand is a valid url. For instance, Google play uses it for its images and icons.

Don't detect the ";" in the URL

I used the valid-url for my project.
I detected one issue when use this module for the URL that contain ";".
In URL Object it detects that this is not URL but valie-url module passed this.
Could you fix this?

This is my code.

var validUrl = require('valid-url');

if (validUrl.isUri('https://shop.delacier.com;hu.shop.delacier.com/products.json')){
console.log('Looks like an URI');
var myURL = new URL('https://shop.delacier.com;hu.shop.delacier.com/products.json');
console.log(myURL);
} else {

console.log('Not a URI');
var myURL = new URL('https://shop.delacier.com;hu.shop.delacier.com/products.json');
console.log(myURL);

}

Error is following

×
TypeError: Failed to construct 'URL': Invalid URL
Module../src/Pages/AddFeed/FeedUpload.js
E:/ModaComprise/NewCollabration/src/Pages/AddFeed/FeedUpload.js:33
30 |
31 | if (validUrl.isUri('https://shop.delacier.com;hu.shop.delacier.com/products.json')){
32 | console.log('Looks like an URI');

33 | var myURL = new URL('https://shop.delacier.com;hu.shop.delacier.com/products.json');
34 | console.log(myURL);
35 | } else {
36 |
View compiled

SSH URI

Hi! I've been using this great library for a while and doesn't have problem at all. Until I try to use it to validate a github ssh url, like "git@github:xxx/repo.git". Is this SSH uri also a valid url that we should support in this library?

*Reference for the ssh url https://tools.ietf.org/id/draft-salowey-secsh-uri-00.html.

Tests are only checking valid possibilities

The tests aren't the original ones included in the perl code.
The current version includes only a few positive tests - return true in every function is considered an acceptable result..

This means that we can't have confidence that the implementation/functionality of the module is consistent with the original.

Should have noticed when the original pull request came ....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.