diff options
-rw-r--r-- | app/assets/javascripts/blob_edit/blob_bundle.js | 2 | ||||
-rw-r--r-- | changelogs/unreleased/fix-blob-editor-deleting-content.yml | 5 | ||||
-rw-r--r-- | spec/features/projects/blobs/edit_spec.rb | 9 |
3 files changed, 15 insertions, 1 deletions
diff --git a/app/assets/javascripts/blob_edit/blob_bundle.js b/app/assets/javascripts/blob_edit/blob_bundle.js index 5f64175362d..6aaf5bf7296 100644 --- a/app/assets/javascripts/blob_edit/blob_bundle.js +++ b/app/assets/javascripts/blob_edit/blob_bundle.js @@ -13,7 +13,7 @@ export default () => { if (editBlobForm.length) { const urlRoot = editBlobForm.data('relativeUrlRoot'); const assetsPath = editBlobForm.data('assetsPrefix'); - const filePath = editBlobForm.data('blobFilename'); + const filePath = `${editBlobForm.data('blobFilename')}`; const currentAction = $('.js-file-title').data('currentAction'); const projectId = editBlobForm.data('project-id'); const isMarkdown = editBlobForm.data('is-markdown'); diff --git a/changelogs/unreleased/fix-blob-editor-deleting-content.yml b/changelogs/unreleased/fix-blob-editor-deleting-content.yml new file mode 100644 index 00000000000..d5b7bbc7b1c --- /dev/null +++ b/changelogs/unreleased/fix-blob-editor-deleting-content.yml @@ -0,0 +1,5 @@ +--- +title: Fixed blob editor deleting file content for certain file paths +merge_request: +author: +type: fixed diff --git a/spec/features/projects/blobs/edit_spec.rb b/spec/features/projects/blobs/edit_spec.rb index 828f6f9921e..57d21f3e182 100644 --- a/spec/features/projects/blobs/edit_spec.rb +++ b/spec/features/projects/blobs/edit_spec.rb @@ -49,6 +49,15 @@ describe 'Editing file blob', :js do 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 before do visit project_blob_path(project, tree_join(branch, file_path)) |