Skip to content

Don't detect the ";" in the URL #29

@lionpunk

Description

@lionpunk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions