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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
a95f8b9a
Commit
a95f8b9a
authored
Jun 15, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'stanhu/gitlab-ce-fix-error-500-false-binary-negative'
parents
a6042a2d
0fdfd2dd
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
27 additions
and
5 deletions
+27
-5
CHANGELOG
CHANGELOG
+1
-0
Gemfile.lock
Gemfile.lock
+2
-2
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+1
-1
app/models/blob.rb
app/models/blob.rb
+1
-1
app/models/repository.rb
app/models/repository.rb
+1
-1
app/views/projects/diffs/_diffs.html.haml
app/views/projects/diffs/_diffs.html.haml
+1
-0
app/views/projects/diffs/_file.html.haml
app/views/projects/diffs/_file.html.haml
+2
-0
spec/controllers/blob_controller_spec.rb
spec/controllers/blob_controller_spec.rb
+5
-0
spec/controllers/projects/commit_controller_spec.rb
spec/controllers/projects/commit_controller_spec.rb
+12
-0
spec/support/test_env.rb
spec/support/test_env.rb
+1
-0
No files found.
CHANGELOG
View file @
a95f8b9a
...
@@ -25,6 +25,7 @@ v 8.9.0 (unreleased)
...
@@ -25,6 +25,7 @@ v 8.9.0 (unreleased)
- Remove project notification settings associated with deleted projects
- Remove project notification settings associated with deleted projects
- Fix 404 page when viewing TODOs that contain milestones or labels in different projects
- Fix 404 page when viewing TODOs that contain milestones or labels in different projects
- Add a metric for the number of new Redis connections created by a transaction
- Add a metric for the number of new Redis connections created by a transaction
- Fix Error 500 when viewing a blob with binary characters after the 1024-byte mark
- Redesign navigation for project pages
- Redesign navigation for project pages
- Fix groups API to list only user's accessible projects
- Fix groups API to list only user's accessible projects
- Add Environments and Deployments
- Add Environments and Deployments
...
...
Gemfile.lock
View file @
a95f8b9a
...
@@ -277,7 +277,7 @@ GEM
...
@@ -277,7 +277,7 @@ GEM
posix-spawn (~> 0.3)
posix-spawn (~> 0.3)
gitlab_emoji (0.3.1)
gitlab_emoji (0.3.1)
gemojione (~> 2.2, >= 2.2.1)
gemojione (~> 2.2, >= 2.2.1)
gitlab_git (10.1.
0
)
gitlab_git (10.1.
3
)
activesupport (~> 4.0)
activesupport (~> 4.0)
charlock_holmes (~> 0.7.3)
charlock_holmes (~> 0.7.3)
github-linguist (~> 4.7.0)
github-linguist (~> 4.7.0)
...
@@ -400,7 +400,7 @@ GEM
...
@@ -400,7 +400,7 @@ GEM
mime-types (>= 1.16, < 4)
mime-types (>= 1.16, < 4)
mail_room (0.7.0)
mail_room (0.7.0)
method_source (0.8.2)
method_source (0.8.2)
mime-types (2.99.
1
)
mime-types (2.99.
2
)
mimemagic (0.3.0)
mimemagic (0.3.0)
mini_portile2 (2.1.0)
mini_portile2 (2.1.0)
minitest (5.7.0)
minitest (5.7.0)
...
...
app/helpers/blob_helper.rb
View file @
a95f8b9a
...
@@ -116,7 +116,7 @@ module BlobHelper
...
@@ -116,7 +116,7 @@ module BlobHelper
end
end
def
blob_text_viewable?
(
blob
)
def
blob_text_viewable?
(
blob
)
blob
&&
blob
.
text?
&&
!
blob
.
lfs_pointer?
blob
&&
blob
.
text?
&&
!
blob
.
lfs_pointer?
&&
!
blob
.
only_display_raw?
end
end
def
blob_size
(
blob
)
def
blob_size
(
blob
)
...
...
app/models/blob.rb
View file @
a95f8b9a
...
@@ -24,7 +24,7 @@ class Blob < SimpleDelegator
...
@@ -24,7 +24,7 @@ class Blob < SimpleDelegator
end
end
def
only_display_raw?
def
only_display_raw?
size
&&
size
>
5
.
megabytes
size
&&
truncated?
end
end
def
svg?
def
svg?
...
...
app/models/repository.rb
View file @
a95f8b9a
...
@@ -446,7 +446,7 @@ class Repository
...
@@ -446,7 +446,7 @@ class Repository
def
blob_at
(
sha
,
path
)
def
blob_at
(
sha
,
path
)
unless
Gitlab
::
Git
.
blank_ref?
(
sha
)
unless
Gitlab
::
Git
.
blank_ref?
(
sha
)
Gitlab
::
Git
::
Blob
.
find
(
self
,
sha
,
path
)
Blob
.
decorate
(
Gitlab
::
Git
::
Blob
.
find
(
self
,
sha
,
path
)
)
end
end
end
end
...
...
app/views/projects/diffs/_diffs.html.haml
View file @
a95f8b9a
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
-
diff_commit
=
commit_for_diff
(
diff_file
)
-
diff_commit
=
commit_for_diff
(
diff_file
)
-
blob
=
project
.
repository
.
blob_for_diff
(
diff_commit
,
diff_file
)
-
blob
=
project
.
repository
.
blob_for_diff
(
diff_commit
,
diff_file
)
-
next
unless
blob
-
next
unless
blob
-
blob
.
load_all_data!
(
project
.
repository
)
unless
blob
.
only_display_raw?
=
render
'projects/diffs/file'
,
i:
index
,
project:
project
,
=
render
'projects/diffs/file'
,
i:
index
,
project:
project
,
diff_file:
diff_file
,
diff_commit:
diff_commit
,
blob:
blob
,
diff_refs:
diff_refs
diff_file:
diff_file
,
diff_commit:
diff_commit
,
blob:
blob
,
diff_refs:
diff_refs
app/views/projects/diffs/_file.html.haml
View file @
a95f8b9a
...
@@ -49,6 +49,8 @@
...
@@ -49,6 +49,8 @@
=
render
"projects/diffs/parallel_view"
,
diff_file:
diff_file
,
project:
project
,
blob:
blob
,
index:
i
=
render
"projects/diffs/parallel_view"
,
diff_file:
diff_file
,
project:
project
,
blob:
blob
,
index:
i
-
else
-
else
=
render
"projects/diffs/text_file"
,
diff_file:
diff_file
,
index:
i
=
render
"projects/diffs/text_file"
,
diff_file:
diff_file
,
index:
i
-
elsif
blob
.
only_display_raw?
.nothing-here-block
This file is too large to display.
-
elsif
blob
.
image?
-
elsif
blob
.
image?
-
old_file
=
project
.
repository
.
prev_blob_for_diff
(
diff_commit
,
diff_file
)
-
old_file
=
project
.
repository
.
prev_blob_for_diff
(
diff_commit
,
diff_file
)
=
render
"projects/diffs/image"
,
diff_file:
diff_file
,
old_file:
old_file
,
file:
blob
,
index:
i
,
diff_refs:
diff_refs
=
render
"projects/diffs/image"
,
diff_file:
diff_file
,
old_file:
old_file
,
file:
blob
,
index:
i
,
diff_refs:
diff_refs
...
...
spec/controllers/blob_controller_spec.rb
View file @
a95f8b9a
...
@@ -38,6 +38,11 @@ describe Projects::BlobController do
...
@@ -38,6 +38,11 @@ describe Projects::BlobController do
let
(
:id
)
{
'invalid-branch/README.md'
}
let
(
:id
)
{
'invalid-branch/README.md'
}
it
{
is_expected
.
to
respond_with
(
:not_found
)
}
it
{
is_expected
.
to
respond_with
(
:not_found
)
}
end
end
context
"binary file"
do
let
(
:id
)
{
'binary-encoding/encoding/binary-1.bin'
}
it
{
is_expected
.
to
respond_with
(
:success
)
}
end
end
end
describe
'GET show with tree path'
do
describe
'GET show with tree path'
do
...
...
spec/controllers/projects/commit_controller_spec.rb
View file @
a95f8b9a
...
@@ -2,6 +2,8 @@ require 'rails_helper'
...
@@ -2,6 +2,8 @@ require 'rails_helper'
describe
Projects
::
CommitController
do
describe
Projects
::
CommitController
do
describe
'GET show'
do
describe
'GET show'
do
render_views
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
before
do
before
do
...
@@ -27,6 +29,16 @@ describe Projects::CommitController do
...
@@ -27,6 +29,16 @@ describe Projects::CommitController do
end
end
end
end
it
'handles binary files'
do
get
(
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
TestEnv
::
BRANCH_SHA
[
'binary-encoding'
],
format:
"html"
)
expect
(
response
).
to
be_success
end
def
go
(
id
:)
def
go
(
id
:)
get
:show
,
get
:show
,
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
...
...
spec/support/test_env.rb
View file @
a95f8b9a
...
@@ -16,6 +16,7 @@ module TestEnv
...
@@ -16,6 +16,7 @@ module TestEnv
'master'
=>
'5937ac0'
,
'master'
=>
'5937ac0'
,
"'test'"
=>
'e56497b'
,
"'test'"
=>
'e56497b'
,
'orphaned-branch'
=>
'45127a9'
,
'orphaned-branch'
=>
'45127a9'
,
'binary-encoding'
=>
'7b1cf43'
,
}
}
# gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily
# gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily
...
...
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