Commit fc16a228c915437e17dc040e2798c26acac8fd86
1 parent
31987259
Exists in
spb-stable
and in
3 other branches
Fix blobs for file services
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
3 changed files
with
6 additions
and
3 deletions
Show diff stats
app/services/files/create_service.rb
| ... | ... | @@ -24,7 +24,8 @@ module Files |
| 24 | 24 | return error("Your changes could not be committed, because file name contains not allowed characters") |
| 25 | 25 | end |
| 26 | 26 | |
| 27 | - blob = repository.blob_at(ref, file_path) | |
| 27 | + commit = repository.commit(ref) | |
| 28 | + blob = repository.blob_at(commit.sha, file_path) | |
| 28 | 29 | |
| 29 | 30 | if blob |
| 30 | 31 | return error("Your changes could not be committed, because file with such name exists") | ... | ... |
app/services/files/delete_service.rb
| ... | ... | @@ -17,7 +17,8 @@ module Files |
| 17 | 17 | return error("You can only create files if you are on top of a branch") |
| 18 | 18 | end |
| 19 | 19 | |
| 20 | - blob = repository.blob_at(ref, path) | |
| 20 | + commit = repository.commit(ref) | |
| 21 | + blob = repository.blob_at(commit.sha, path) | |
| 21 | 22 | |
| 22 | 23 | unless blob |
| 23 | 24 | return error("You can only edit text files") | ... | ... |
app/services/files/update_service.rb
| ... | ... | @@ -17,7 +17,8 @@ module Files |
| 17 | 17 | return error("You can only create files if you are on top of a branch") |
| 18 | 18 | end |
| 19 | 19 | |
| 20 | - blob = repository.blob_at(ref, path) | |
| 20 | + commit = repository.commit(ref) | |
| 21 | + blob = repository.blob_at(commit.sha, path) | |
| 21 | 22 | |
| 22 | 23 | unless blob |
| 23 | 24 | return error("You can only edit text files") | ... | ... |