Commit d6e18499 authored by Sandeep S. Shewalkar's avatar Sandeep S. Shewalkar
Browse files

DownloadHelper changes

fileavailability check added
parent a4aad7fe
Branches
No related merge requests found
Showing with 9 additions and 6 deletions
......@@ -32,14 +32,17 @@ func DownloadFile(sourcePath, destinationPath, jwtToken string, retryCnt int) (b
return false, errors.New("Either Source/Destination url is empty or source url does not start with 'http'")
}
// dest directory must be a string. check for the same.
destInfo, infoError := filehelper.FileInfo(destinationPath)
if infoError != nil {
return false, errors.New("error occured while getting innformation of destination directory : " + destinationPath)
}
if filehelper.FileAvailabilityCheck(destinationPath) {
destInfo, infoError := filehelper.FileInfo(destinationPath)
if infoError != nil {
return false, errors.New("error occured while getting innformation of destination directory : " + destinationPath)
}
if destInfo.IsDir() {
return false, errors.New("destination path must be a file path, got directory : " + destinationPath)
if destInfo.IsDir() {
return false, errors.New("destination path must be a file path, got directory : " + destinationPath)
}
}
client := grab.NewClient()
req, _ := grab.NewRequest(destinationPath, sourcePath)
if jwtToken != "NA" {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment