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
54113319
Commit
54113319
authored
Jun 01, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use rugged in web editor for base64 encoding
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
d9d9c7d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
34 deletions
+28
-34
app/services/files/create_service.rb
app/services/files/create_service.rb
+14
-17
app/services/files/update_service.rb
app/services/files/update_service.rb
+14
-17
No files found.
app/services/files/create_service.rb
View file @
54113319
...
@@ -33,23 +33,20 @@ module Files
...
@@ -33,23 +33,20 @@ module Files
end
end
end
end
if
params
[
:encoding
]
==
'base64'
content
=
new_file_action
=
Gitlab
::
Satellite
::
NewFileAction
.
new
(
current_user
,
project
,
ref
,
file_path
)
if
params
[
:encoding
]
==
'base64'
created_successfully
=
new_file_action
.
commit!
(
Base64
.
decode64
(
params
[
:content
])
params
[
:content
],
else
params
[
:commit_message
],
params
[
:content
]
params
[
:encoding
],
end
params
[
:new_branch
]
)
created_successfully
=
repository
.
commit_file
(
else
current_user
,
created_successfully
=
repository
.
commit_file
(
file_path
,
current_user
,
content
,
file_path
,
params
[
:commit_message
],
params
[
:content
],
params
[
:new_branch
]
||
ref
params
[
:commit_message
],
)
params
[
:new_branch
]
||
ref
)
end
if
created_successfully
if
created_successfully
...
...
app/services/files/update_service.rb
View file @
54113319
...
@@ -19,23 +19,20 @@ module Files
...
@@ -19,23 +19,20 @@ module Files
return
error
(
"You can only edit text files"
)
return
error
(
"You can only edit text files"
)
end
end
if
params
[
:encoding
]
==
'base64'
content
=
edit_file_action
=
Gitlab
::
Satellite
::
EditFileAction
.
new
(
current_user
,
project
,
ref
,
path
)
if
params
[
:encoding
]
==
'base64'
edit_file_action
.
commit!
(
Base64
.
decode64
(
params
[
:content
])
params
[
:content
],
else
params
[
:commit_message
],
params
[
:content
]
params
[
:encoding
],
end
params
[
:new_branch
]
)
repository
.
commit_file
(
else
current_user
,
repository
.
commit_file
(
path
,
current_user
,
content
,
path
,
params
[
:commit_message
],
params
[
:content
],
params
[
:new_branch
]
||
ref
params
[
:commit_message
],
)
params
[
:new_branch
]
||
ref
)
end
success
success
rescue
Gitlab
::
Satellite
::
CheckoutFailed
=>
ex
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