From f81967ceaca132aa30ce4622c6a34a6097a2fe8f Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 3 Sep 2008 15:06:09 +0000 Subject: ensure _sync_raw() is never called with undefined $medium --- urpm/download.pm | 10 ++++++++-- 1 file 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 { -- cgit v1.2.1