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
This commit is contained in:
Phil Hughes 2019-03-07 12:35:07 +00:00
parent 45b3c5420c
commit 6a3a28bfde
No known key found for this signature in database
GPG Key ID: 32245528C52E0F9F
3 changed files with 15 additions and 1 deletions

View File

@ -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');

View File

@ -0,0 +1,5 @@
---
title: Fixed blob editor deleting file content for certain file paths
merge_request:
author:
type: fixed

View File

@ -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))