New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting Password Leaves Colon Behind #13

Open
theory opened this Issue Dec 6, 2013 · 0 comments

Comments

Projects
None yet
1 participant
@theory

theory commented Dec 6, 2013

 % perl -MURI -E 'my $u = URI->new("rsync://foo:bar\@example.com"); $u->password(undef); say $u'
rsync://foo:@example.com

I think the output should actually be:

rsync://foo@example.com

I think this patch would fix it:

--- a/URI/_userpass.pm
+++ b/URI/_userpass.pm
@@ -35,8 +35,8 @@ sub password
    my $user = defined($info) ? $info : "";
    $user =~ s/:.*//;

-   if (!defined($new) && !length($user)) {
-       $self->userinfo(undef);
+   if (!defined($new)) {
+       $self->userinfo(length $user ? $user : undef);
    } else {
        $new = "" unless defined($new);
        $new =~ s/%/%25/g;

joenio added a commit to joenio/uri that referenced this issue Jan 24, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment