Commit 172c6cef authored by Brandon Labuschagne's avatar Brandon Labuschagne Committed by Olena Horal-Koretska

Fix repo file upload bug

The bootstrap modal migration resulted
in only images being able to be uploaded
from the repo file upload tool.

This commit opens the uploads to files
of any type.
parent dcc14623
...@@ -168,6 +168,7 @@ export default { ...@@ -168,6 +168,7 @@ export default {
}); });
}, },
}, },
validFileMimetypes: [],
}; };
</script> </script>
<template> <template>
...@@ -179,7 +180,12 @@ export default { ...@@ -179,7 +180,12 @@ export default {
:action-cancel="cancelOptions" :action-cancel="cancelOptions"
@primary.prevent="uploadFile" @primary.prevent="uploadFile"
> >
<upload-dropzone class="gl-h-200! gl-mb-4" single-file-selection @change="setFile"> <upload-dropzone
class="gl-h-200! gl-mb-4"
single-file-selection
:valid-file-mimetypes="$options.validFileMimetypes"
@change="setFile"
>
<div <div
v-if="file" v-if="file"
class="card upload-dropzone-card upload-dropzone-border gl-w-full gl-h-full gl-align-items-center gl-justify-content-center gl-p-3" class="card upload-dropzone-card upload-dropzone-border gl-w-full gl-h-full gl-align-items-center gl-justify-content-center gl-p-3"
......
---
title: Allow all file types to be uploaded from the repo file upload tool
merge_request: 57498
author:
type: fixed
...@@ -19,9 +19,11 @@ RSpec.describe 'Projects > Files > User uploads files' do ...@@ -19,9 +19,11 @@ RSpec.describe 'Projects > Files > User uploads files' do
wait_for_requests wait_for_requests
end end
include_examples 'it uploads and commit a new text file' include_examples 'it uploads and commits a new text file'
include_examples 'it uploads and commit a new image file' include_examples 'it uploads and commits a new image file'
include_examples 'it uploads and commits a new pdf file'
include_examples 'it uploads a file to a sub-directory' include_examples 'it uploads a file to a sub-directory'
end end
...@@ -33,6 +35,6 @@ RSpec.describe 'Projects > Files > User uploads files' do ...@@ -33,6 +35,6 @@ RSpec.describe 'Projects > Files > User uploads files' do
visit(project_tree_path(project2)) visit(project_tree_path(project2))
end end
include_examples 'it uploads and commit a new file to a forked project' include_examples 'it uploads and commits a new file to a forked project'
end end
end end
...@@ -21,9 +21,11 @@ RSpec.describe 'Projects > Show > User uploads files' do ...@@ -21,9 +21,11 @@ RSpec.describe 'Projects > Show > User uploads files' do
wait_for_requests wait_for_requests
end end
include_examples 'it uploads and commit a new text file' include_examples 'it uploads and commits a new text file'
include_examples 'it uploads and commit a new image file' include_examples 'it uploads and commits a new image file'
include_examples 'it uploads and commits a new pdf file'
include_examples 'it uploads a file to a sub-directory' include_examples 'it uploads a file to a sub-directory'
end end
...@@ -35,7 +37,7 @@ RSpec.describe 'Projects > Show > User uploads files' do ...@@ -35,7 +37,7 @@ RSpec.describe 'Projects > Show > User uploads files' do
visit(project_path(project2)) visit(project_path(project2))
end end
include_examples 'it uploads and commit a new file to a forked project' include_examples 'it uploads and commits a new file to a forked project'
end end
context 'when in the empty_repo_upload experiment' do context 'when in the empty_repo_upload experiment' do
......
# frozen_string_literal: true # frozen_string_literal: true
RSpec.shared_examples 'it uploads and commit a new text file' do RSpec.shared_examples 'it uploads and commits a new text file' do
it 'uploads and commit a new text file', :js do it 'uploads and commits a new text file', :js do
find('.add-to-tree').click find('.add-to-tree').click
page.within('.dropdown-menu') do page.within('.dropdown-menu') do
...@@ -32,8 +32,8 @@ RSpec.shared_examples 'it uploads and commit a new text file' do ...@@ -32,8 +32,8 @@ RSpec.shared_examples 'it uploads and commit a new text file' do
end end
end end
RSpec.shared_examples 'it uploads and commit a new image file' do RSpec.shared_examples 'it uploads and commits a new image file' do
it 'uploads and commit a new image file', :js do it 'uploads and commits a new image file', :js do
find('.add-to-tree').click find('.add-to-tree').click
page.within('.dropdown-menu') do page.within('.dropdown-menu') do
...@@ -58,13 +58,39 @@ RSpec.shared_examples 'it uploads and commit a new image file' do ...@@ -58,13 +58,39 @@ RSpec.shared_examples 'it uploads and commit a new image file' do
end end
end end
RSpec.shared_examples 'it uploads and commit a new file to a forked project' do RSpec.shared_examples 'it uploads and commits a new pdf file' do
it 'uploads and commits a new pdf file', :js do
find('.add-to-tree').click
page.within('.dropdown-menu') do
click_link('Upload file')
wait_for_requests
end
attach_file('upload_file', File.join(Rails.root, 'spec', 'fixtures', 'git-cheat-sheet.pdf'), make_visible: true)
page.within('#modal-upload-blob') do
fill_in(:commit_message, with: 'New commit message')
fill_in(:branch_name, with: 'upload_image', visible: true)
click_button('Upload file')
end
wait_for_all_requests
visit(project_blob_path(project, 'upload_image/git-cheat-sheet.pdf'))
expect(page).to have_css('.js-pdf-viewer')
end
end
RSpec.shared_examples 'it uploads and commits a new file to a forked project' do
let(:fork_message) do let(:fork_message) do
"You're not allowed to make changes to this project directly. "\ "You're not allowed to make changes to this project directly. "\
"A fork of this project has been created that you can make changes in, so you can submit a merge request." "A fork of this project has been created that you can make changes in, so you can submit a merge request."
end end
it 'uploads and commit a new file to a forked project', :js, :sidekiq_might_not_need_inline do it 'uploads and commits a new file to a forked project', :js, :sidekiq_might_not_need_inline do
find('.add-to-tree').click find('.add-to-tree').click
click_link('Upload file') click_link('Upload file')
......
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