BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
815e678c
Commit
815e678c
authored
Aug 11, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Use rugged in web editor for base64 encoding"
This reverts commit
54113319
.
parent
34975f01
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
28 deletions
+34
-28
create_service.rb
app/services/files/create_service.rb
+17
-14
update_service.rb
app/services/files/update_service.rb
+17
-14
No files found.
app/services/files/create_service.rb
View file @
815e678c
...
...
@@ -33,20 +33,23 @@ module Files
end
end
content
=
if
params
[
:encoding
]
==
'base64'
Base64
.
decode64
(
params
[
:content
])
else
params
[
:content
]
end
created_successfully
=
repository
.
commit_file
(
current_user
,
file_path
,
content
,
params
[
:commit_message
],
params
[
:new_branch
]
||
ref
)
if
params
[
:encoding
]
==
'base64'
new_file_action
=
Gitlab
::
Satellite
::
NewFileAction
.
new
(
current_user
,
project
,
ref
,
file_path
)
created_successfully
=
new_file_action
.
commit!
(
params
[
:content
],
params
[
:commit_message
],
params
[
:encoding
],
params
[
:new_branch
]
)
else
created_successfully
=
repository
.
commit_file
(
current_user
,
file_path
,
params
[
:content
],
params
[
:commit_message
],
params
[
:new_branch
]
||
ref
)
end
if
created_successfully
...
...
app/services/files/update_service.rb
View file @
815e678c
...
...
@@ -19,20 +19,23 @@ module Files
return
error
(
"You can only edit text files"
)
end
content
=
if
params
[
:encoding
]
==
'base64'
Base64
.
decode64
(
params
[
:content
])
else
params
[
:content
]
end
repository
.
commit_file
(
current_user
,
path
,
content
,
params
[
:commit_message
],
params
[
:new_branch
]
||
ref
)
if
params
[
:encoding
]
==
'base64'
edit_file_action
=
Gitlab
::
Satellite
::
EditFileAction
.
new
(
current_user
,
project
,
ref
,
path
)
edit_file_action
.
commit!
(
params
[
:content
],
params
[
:commit_message
],
params
[
:encoding
],
params
[
:new_branch
]
)
else
repository
.
commit_file
(
current_user
,
path
,
params
[
:content
],
params
[
:commit_message
],
params
[
:new_branch
]
||
ref
)
end
success
rescue
Gitlab
::
Satellite
::
CheckoutFailed
=>
ex
...
...
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