GRN2-xx: Allowed file types now matches BigBlueButton (#1966)

* Allowed file types now matches BigBlueButton

* Uppercased file types are now allowed

* Rubocop
This commit is contained in:
Ahmad Farhat 2020-08-04 10:35:07 -04:00 committed by GitHub
parent 35c82f9c17
commit 0710c569b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 6 additions and 5 deletions

View File

@ -418,7 +418,8 @@ class RoomsController < ApplicationController
# Checks if the file extension is allowed
def valid_file_type
Rails.configuration.allowed_file_types.split(",").include?(File.extname(room_params[:presentation].original_filename))
Rails.configuration.allowed_file_types.split(",")
.include?(File.extname(room_params[:presentation].original_filename.downcase))
end
# Gets the room setting based on the option set in the room configuration

View File

@ -34,7 +34,7 @@
<p id="invalid-file-type" class="text-danger"><%= t("modal.preupload.invalid") %></p>
<div class="input-group mb-3">
<div class="custom-file text-left">
<%= f.label :presentation, t("modal.preupload.choose", type: allowed_file_types), id:"presentation-upload-label", class: "custom-file-label", "data-placeholder": t("modal.preupload.choose", type: allowed_file_types) %>
<%= f.label :presentation, t("modal.preupload.choose"), id:"presentation-upload-label", class: "custom-file-label", "data-placeholder": t("modal.preupload.choose", type: allowed_file_types) %>
<%= f.file_field :presentation, id: "presentation-upload", class: "custom-file-input cursor-pointer", accept: allowed_file_types, required: "true" %>
</div>
</div>

View File

@ -129,7 +129,7 @@ module Greenlight
config.help_url = ENV["HELP_URL"].nil? ? "https://docs.bigbluebutton.org/greenlight/gl-overview.html" : ENV["HELP_URL"]
# File types allowed in preupload presentation
config.allowed_file_types = ".doc,.docx,.pptx,.pdf"
config.allowed_file_types = ".doc,.docx,.ppt,.pptx,.pdf,.xls,.xlsx,.txt,.rtf,.odt,.ods,.odp,.odg,.odc,.odi,.jpg,.jpeg,.png"
# DEFAULTS

View File

@ -411,7 +411,7 @@ en:
forgot_password: Forgot Password?
preupload:
change: Replace Presentation
choose: Choose a file (%{type})
choose: Choose a file...
current: "Current Presentation:"
footer: Depending on the size of the presentation, it may require additional time to upload before it can be used.
invalid: Invalid size/file type. Please see the restrictions below.

View File

@ -821,7 +821,7 @@ describe RoomsController, type: :controller do
before do
@user = create(:user)
@file = fixture_file_upload('files/sample.pdf', 'application/pdf')
@invalid_file = fixture_file_upload('files/invalid.jpg', 'image/jpg')
@invalid_file = fixture_file_upload('files/invalid.bmp', 'image/bmp')
allow(Rails.configuration).to receive(:preupload_presentation_default).and_return("true")
end

BIN
spec/fixtures/files/invalid.bmp vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB