Commit 6a3a28bf authored by Phil Hughes's avatar Phil Hughes

Fixed the blob editor deleting all content for files

This only happens for files that the path consists of only numbers

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/58578
parent 45b3c542
...@@ -13,7 +13,7 @@ export default () => { ...@@ -13,7 +13,7 @@ export default () => {
if (editBlobForm.length) { if (editBlobForm.length) {
const urlRoot = editBlobForm.data('relativeUrlRoot'); const urlRoot = editBlobForm.data('relativeUrlRoot');
const assetsPath = editBlobForm.data('assetsPrefix'); const assetsPath = editBlobForm.data('assetsPrefix');
const filePath = editBlobForm.data('blobFilename'); const filePath = `${editBlobForm.data('blobFilename')}`;
const currentAction = $('.js-file-title').data('currentAction'); const currentAction = $('.js-file-title').data('currentAction');
const projectId = editBlobForm.data('project-id'); const projectId = editBlobForm.data('project-id');
const isMarkdown = editBlobForm.data('is-markdown'); const isMarkdown = editBlobForm.data('is-markdown');
......
---
title: Fixed blob editor deleting file content for certain file paths
merge_request:
author:
type: fixed
...@@ -49,6 +49,15 @@ describe 'Editing file blob', :js do ...@@ -49,6 +49,15 @@ describe 'Editing file blob', :js do
end end
end end
it 'updates the content of file with a number as file path' do
project.repository.create_file(user, '1', 'test', message: 'testing', branch_name: branch)
visit project_blob_path(project, tree_join(branch, '1'))
edit_and_commit
expect(page).to have_content 'NextFeature'
end
context 'from blob file path' do context 'from blob file path' do
before do before do
visit project_blob_path(project, tree_join(branch, file_path)) visit project_blob_path(project, tree_join(branch, file_path))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment