Skip to content

redirect when using window.location #172

Closed
@knownun

Description

@knownun

Hello, enjoying your library, it's very helpful.

But with the recent update, if you accidentally do this

new UrlParse(window.location)

UrlParse redirect page to this path
%5E[/x09/x0A/x0B/x0C/x0D/x20/xA0/u1680/u180E/u2000/u2001/u2002/u2003/u2004/u2005/u2006/u2007/u2008/u2009/u200A/u202F/u205F/u3000/u2028/u2029/uFEFF]+/

That happens because of
image
image

In case str is a location Object

would be really helpful if you can add some kind of error, or cast address to a string

function Url(address, location, parser) {
  address = trimLeft(`${address}`);
function Url(address, location, parser) {
  address = trimLeft(address.toString());
function Url(address, location, parser) {
  if (typeof address !== 'string') {
    throw new Error('some text here');
  }
  address = trimLeft(address);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions