summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-09-03 15:06:09 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-09-03 15:06:09 +0000
commitf81967ceaca132aa30ce4622c6a34a6097a2fe8f (patch)
tree40704480f0221ece11d9681d25edb97bd3e8e572
parent02cf39fa6f57da19936ec5119a49bc135765f578 (diff)
downloadurpmi-f81967ceaca132aa30ce4622c6a34a6097a2fe8f.tar
urpmi-f81967ceaca132aa30ce4622c6a34a6097a2fe8f.tar.gz
urpmi-f81967ceaca132aa30ce4622c6a34a6097a2fe8f.tar.bz2
urpmi-f81967ceaca132aa30ce4622c6a34a6097a2fe8f.tar.xz
urpmi-f81967ceaca132aa30ce4622c6a34a6097a2fe8f.zip
ensure _sync_raw() is never called with undefined $medium
-rw-r--r--urpm/download.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/urpm/download.pm b/urpm/download.pm
index b063f35f..745c38be 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -789,7 +789,7 @@ sub sync_rel {
sub sync_url {
my ($urpm, $url, %options) = @_;
- _sync_raw($urpm, undef, [$url], %options);
+ sync_rel($urpm, { url => dirname($url) }, [basename($url)], %options);
}
#- deprecated, use sync_url() or sync_rel() instead
@@ -798,7 +798,13 @@ sub sync_url {
#- known options: quiet, resume, callback
sub sync {
my ($urpm, $medium, $files, %options) = @_;
- _sync_raw($urpm, $medium, $files, %options);
+
+ if ($medium) {
+ _sync_raw($urpm, $medium, $files, %options);
+ } else {
+ @$files == 1 or die "urpm::download::sync() can only download one url when medium is undef\n";
+ sync_url($urpm, $files->[0], %options);
+ }
}
sub _sync_raw {