Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
26d97ac5
Commit
26d97ac5
authored
Jan 28, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send more raw blob data with workhorse
parent
9109619e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
10 deletions
+11
-10
app/controllers/projects/avatars_controller.rb
app/controllers/projects/avatars_controller.rb
+6
-7
app/controllers/projects/raw_controller.rb
app/controllers/projects/raw_controller.rb
+1
-1
lib/api/repositories.rb
lib/api/repositories.rb
+4
-2
No files found.
app/controllers/projects/avatars_controller.rb
View file @
26d97ac5
...
@@ -2,15 +2,14 @@ class Projects::AvatarsController < Projects::ApplicationController
...
@@ -2,15 +2,14 @@ class Projects::AvatarsController < Projects::ApplicationController
before_action
:project
before_action
:project
def
show
def
show
@blob
=
@project
.
repository
.
blob_at_branch
(
'master'
,
@project
.
avatar_in_git
)
repository
=
@project
.
repository
@blob
=
repository
.
blob_at_branch
(
'master'
,
@project
.
avatar_in_git
)
if
@blob
if
@blob
headers
[
'X-Content-Type-Options'
]
=
'nosniff'
headers
[
'X-Content-Type-Options'
]
=
'nosniff'
send_data
(
headers
[
'Gitlab-Workhorse-Repo-Path'
]
=
repository
.
path_to_repo
@blob
.
data
,
headers
[
'Gitlab-Workhorse-Send-Blob'
]
=
@blob
.
id
type:
@blob
.
mime_type
,
headers
[
'Content-Disposition'
]
=
'inline'
disposition:
'inline'
,
render
nothing:
true
,
content_type:
@blob
.
content_type
filename:
@blob
.
name
)
else
else
render_404
render_404
end
end
...
...
app/controllers/projects/raw_controller.rb
View file @
26d97ac5
...
@@ -18,7 +18,7 @@ class Projects::RawController < Projects::ApplicationController
...
@@ -18,7 +18,7 @@ class Projects::RawController < Projects::ApplicationController
send_lfs_object
send_lfs_object
else
else
headers
[
'Gitlab-Workhorse-Repo-Path'
]
=
@repository
.
path_to_repo
headers
[
'Gitlab-Workhorse-Repo-Path'
]
=
@repository
.
path_to_repo
headers
[
'Gitlab-Workhorse-Send-Blob'
]
=
Base64
.
urlsafe_encode64
(
@commit
.
id
+
':'
+
@path
)
headers
[
'Gitlab-Workhorse-Send-Blob'
]
=
@blob
.
id
headers
[
'Content-Disposition'
]
=
'inline'
headers
[
'Content-Disposition'
]
=
'inline'
render
nothing:
true
,
content_type:
get_blob_type
render
nothing:
true
,
content_type:
get_blob_type
end
end
...
...
lib/api/repositories.rb
View file @
26d97ac5
...
@@ -57,7 +57,8 @@ module API
...
@@ -57,7 +57,8 @@ module API
not_found!
"File"
unless
blob
not_found!
"File"
unless
blob
content_type
'text/plain'
content_type
'text/plain'
present
blob
.
data
header
'Gitlab-Workhorse-Repo-Path'
,
repo
.
path_to_repo
header
'Gitlab-Workhorse-Send-Blob'
,
blob
.
id
end
end
# Get a raw blob contents by blob sha
# Get a raw blob contents by blob sha
...
@@ -83,7 +84,8 @@ module API
...
@@ -83,7 +84,8 @@ module API
env
[
'api.format'
]
=
:txt
env
[
'api.format'
]
=
:txt
content_type
blob
.
mime_type
content_type
blob
.
mime_type
present
blob
.
data
header
'Gitlab-Workhorse-Repo-Path'
,
repo
.
path_to_repo
header
'Gitlab-Workhorse-Send-Blob'
,
blob
.
id
end
end
# Get a an archive of the repository
# Get a an archive of the repository
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment