[bbb-greenlight: 2/16] GRN2-xx: Allowed file types now matches BigBlueButton (#1966)
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bbb-greenlight: 2/16] GRN2-xx: Allowed file types now matches BigBlueButton (#1966)
- Date: Thu, 6 Aug 2020 05:15:48 +0000 (UTC)
commit 0710c569b709930796f315ac7c09b1ee17e1f7d0
Author: Ahmad Farhat <ahmad af farhat gmail com>
Date: Tue Aug 4 10:35:07 2020 -0400
GRN2-xx: Allowed file types now matches BigBlueButton (#1966)
* Allowed file types now matches BigBlueButton
* Uppercased file types are now allowed
* Rubocop
app/controllers/rooms_controller.rb | 3 ++-
.../modals/_preupload_presentation_modal.html.erb | 2 +-
config/application.rb | 2 +-
config/locales/en.yml | 2 +-
spec/controllers/rooms_controller_spec.rb | 2 +-
spec/fixtures/files/invalid.bmp | Bin 0 -> 46182 bytes
spec/fixtures/files/invalid.jpg | Bin 102117 -> 0 bytes
7 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/app/controllers/rooms_controller.rb b/app/controllers/rooms_controller.rb
index b278365..7624eb8 100644
--- a/app/controllers/rooms_controller.rb
+++ b/app/controllers/rooms_controller.rb
@@ -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
diff --git a/app/views/shared/modals/_preupload_presentation_modal.html.erb
b/app/views/shared/modals/_preupload_presentation_modal.html.erb
index fa3e193..ffb4e79 100644
--- a/app/views/shared/modals/_preupload_presentation_modal.html.erb
+++ b/app/views/shared/modals/_preupload_presentation_modal.html.erb
@@ -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>
diff --git a/config/application.rb b/config/application.rb
index 8fe4db4..c310537 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -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
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 36443b4..c99cd20 100755
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -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.
diff --git a/spec/controllers/rooms_controller_spec.rb b/spec/controllers/rooms_controller_spec.rb
index 59b661e..5036fa5 100644
--- a/spec/controllers/rooms_controller_spec.rb
+++ b/spec/controllers/rooms_controller_spec.rb
@@ -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
diff --git a/spec/fixtures/files/invalid.bmp b/spec/fixtures/files/invalid.bmp
new file mode 100644
index 0000000..b61d368
Binary files /dev/null and b/spec/fixtures/files/invalid.bmp differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]