[Title] fix nil check for download file in cache
authorjiil.hyoun <jiil.hyoun@samsung.com>
Fri, 15 Mar 2013 08:24:02 +0000 (17:24 +0900)
committerjiil.hyoun <jiil.hyoun@samsung.com>
Fri, 15 Mar 2013 08:24:02 +0000 (17:24 +0900)
[Type] Bugfix
[Module] Toolchain /
[Priority] Major
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

Change-Id: I4a0e77dbdd217d333cc97564f2a542ada21fd992

src/pkg_server/client.rb

index 0f18d73f0be103e5393066c7b5b0d2aa8d72b7b8..a55ed22e5c70b41eb9d227fcb1495402488989fb 100644 (file)
@@ -314,13 +314,15 @@ class Client
                        file_path = get_file_from_cache(filename, pkg_checksum, pkg_size, loc)
                        if file_path.nil? then
 
-                               if not FileDownLoader.download(url, loc, @log) then
+                               file_path = File.join(loc, filename)
+
+                               result = FileDownLoader.download(url, loc, @log)
+                               if not result or not File.exist? file_path then
                                        @log.error "File Download Failed!!"
                                        @log.error "* #{url} -> #{loc}"
                                        return nil
                                end
 
-                               file_path = File.join(loc, filename)
                                if validatePkgFile(file_path, pkg_checksum, pkg_size) then
                                        add_file_to_cache(file_path)
                                else