summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-19 09:44:29 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-19 09:44:29 +0000
commit88d1c2e77a358b8f3175a0ebf73326f20c3eff45 (patch)
tree350ce11dbea237dae3e8034a9d28777e74de43b0
parent509a7c8b1892809536e34439daf35060025839d9 (diff)
fix scp url parsing and printing
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
index 74bdfdc5074..f373994b931 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: SCP.pm,v 1.12 2007/05/17 18:59:38 espie Exp $
+# $OpenBSD: SCP.pm,v 1.13 2007/05/19 09:44:28 espie Exp $
#
# Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org>
#
@@ -106,9 +106,12 @@ sub grab_object
sub _new
{
my ($class, $baseurl) = @_;
- $baseurl =~ s/^\/\///i;
- $baseurl =~ m/\//;
- bless { host => $`, baseurl => $baseurl, key => $`, path => "/$'" }, $class;
+ if ($baseurl =~ m/^\/\/(.*?)(\/.*)$/) {
+ bless { host => $1, baseurl => $baseurl,
+ key => $1, path => $2 }, $class;
+ } else {
+ die "Invalid scp url: scp:$baseurl\n";
+ }
}
sub maxcount