summaryrefslogtreecommitdiff
path: root/app/models/lfs_object.rb
diff options
context:
space:
mode:
authorMarin Jankovski <maxlazio@gmail.com>2015-12-03 14:59:10 +0100
committerMarin Jankovski <maxlazio@gmail.com>2015-12-03 14:59:10 +0100
commit0a081e7eff9730beebd4bea1eb40873d907b6293 (patch)
tree22a08d359a27cd13ddf34247fa1cb95642ec1af9 /app/models/lfs_object.rb
parent6689224a90f3d2500be5d927ea1ed9656fc7b1b6 (diff)
downloadgitlab-ce-0a081e7eff9730beebd4bea1eb40873d907b6293.tar.gz
If a user clicks on the LFS object, it should be served if the user has access to the object.
Diffstat (limited to 'app/models/lfs_object.rb')
-rw-r--r--app/models/lfs_object.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/lfs_object.rb b/app/models/lfs_object.rb
index 3c1426f59d0..f087d07b5b2 100644
--- a/app/models/lfs_object.rb
+++ b/app/models/lfs_object.rb
@@ -5,4 +5,14 @@ class LfsObject < ActiveRecord::Base
validates :oid, presence: true, uniqueness: true
mount_uploader :file, LfsObjectUploader
+
+ MATCH_FROM_POINTER_REGEX = "(?<=sha256:)([0-9a-f]{64})"
+
+ def storage_project(project)
+ if project && project.forked?
+ project.forked_from_project
+ else
+ project
+ end
+ end
end