Skip to content
Snippets Groups Projects
Commit f817eecb authored by Jacob Vosmaer (GitLab)'s avatar Jacob Vosmaer (GitLab)
Browse files

Use && and || instead of if

parent 0012de8c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -68,22 +68,13 @@ class Projects::LfsStorageController < Projects::GitHttpClientController
end
 
def store_file(oid, size, tmp_file)
# Define tmp_file_path early because we use it in "ensure"
tmp_file_path = File.join("#{Gitlab.config.lfs.storage_path}/tmp/upload", tmp_file)
 
object = LfsObject.find_or_create_by(oid: oid, size: size)
if object.file.exists?
success = true
else
success = move_tmp_file_to_storage(object, tmp_file_path)
end
if success
success = link_to_project(object)
end
success
file_exists = object.file.exists? || move_tmp_file_to_storage(object, tmp_file_path)
file_exists && link_to_project(object)
ensure
# Ensure that the tmp file is removed
FileUtils.rm_f(tmp_file_path)
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment