summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rhimport/fetcher.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/rhimport/fetcher.go b/rhimport/fetcher.go
index ff25ae3..b248483 100644
--- a/rhimport/fetcher.go
+++ b/rhimport/fetcher.go
@@ -75,7 +75,12 @@ func curlWriteCallback(ptr []byte, userdata interface{}) bool {
data := userdata.(*FetcherCurlCBData)
if data.file == nil {
if data.filename == "" {
- data.filename = filepath.Join(data.basepath, path.Clean("/"+data.remotename))
+ name := path.Clean("/" + data.remotename)
+ if name == "/" {
+ rhdl.Printf("remotename('%s') is invalid, replacing it with 'unnamed'", data.remotename)
+ name = "unnamed"
+ }
+ data.filename = filepath.Join(data.basepath, name)
}
fp, err := os.OpenFile(data.filename, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600)
if err != nil {