fix(bbb-web and html5): removed .odi and .odc file-type supports (back-port) (#20738)

* [backport-20729] just backported and added information to the docs

* [backport-20729] better description

* [backport-20729] prettier documentation on file formats

Co-authored-by: Gustavo Trott <gustavo@trott.com.br>

---------

Co-authored-by: Gustavo Trott <gustavo@trott.com.br>
This commit is contained in:
Guilherme Pereira Leme 2024-07-19 15:58:24 -03:00 committed by GitHub
parent 9377121704
commit baa62ab1ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 65 additions and 26 deletions

View File

@ -31,6 +31,7 @@ public final class FileTypeConstants {
public static final String RTF = "rtf"; public static final String RTF = "rtf";
public static final String TXT = "txt"; public static final String TXT = "txt";
public static final String ODS = "ods"; public static final String ODS = "ods";
public static final String ODG = "odg";
public static final String ODP = "odp"; public static final String ODP = "odp";
public static final String AVI = "avi"; public static final String AVI = "avi";
public static final String MPG = "mpg"; public static final String MPG = "mpg";
@ -38,6 +39,7 @@ public final class FileTypeConstants {
public static final String PDF = "pdf"; public static final String PDF = "pdf";
public static final String JPG = "jpg"; public static final String JPG = "jpg";
public static final String JPEG = "jpeg"; public static final String JPEG = "jpeg";
public static final String WEBP = "webp";
public static final String PNG = "png"; public static final String PNG = "png";
public static final String SVG = "svg"; public static final String SVG = "svg";
private FileTypeConstants() {} // Prevent instantiation private FileTypeConstants() {} // Prevent instantiation

View File

@ -19,12 +19,17 @@ public class MimeTypeUtils {
private static final String RTF = "application/rtf"; private static final String RTF = "application/rtf";
private static final String TXT = "text/plain"; private static final String TXT = "text/plain";
private static final String ODS = "application/vnd.oasis.opendocument.spreadsheet"; private static final String ODS = "application/vnd.oasis.opendocument.spreadsheet";
private static final String ODG = "application/vnd.oasis.opendocument.graphics";
private static final String ODP = "application/vnd.oasis.opendocument.presentation"; private static final String ODP = "application/vnd.oasis.opendocument.presentation";
private static final String PDF = "application/pdf"; private static final String PDF = "application/pdf";
private static final String JPEG = "image/jpeg"; private static final String JPEG = "image/jpeg";
private static final String PNG = "image/png"; private static final String PNG = "image/png";
private static final String SVG = "image/svg+xml"; private static final String SVG = "image/svg+xml";
private static final String WEBP = "image/webp";
// If the following mime-types are changed, please, make sure to also change:
// bigbluebutton-html5/private/config/settings.yml: L827
// docs/docs/development/api.md: L1222
private static final HashMap<String, List<String>> EXTENSIONS_MIME = new HashMap<String, List<String>>(16) { private static final HashMap<String, List<String>> EXTENSIONS_MIME = new HashMap<String, List<String>>(16) {
{ {
put(FileTypeConstants.DOC, Arrays.asList(DOC, DOCX, TIKA_MSOFFICE, TIKA_MSOFFICE_X)); put(FileTypeConstants.DOC, Arrays.asList(DOC, DOCX, TIKA_MSOFFICE, TIKA_MSOFFICE_X));
@ -34,6 +39,7 @@ public class MimeTypeUtils {
put(FileTypeConstants.PPTX, Arrays.asList(PPT, PPTX, TIKA_MSOFFICE, TIKA_MSOFFICE_X)); put(FileTypeConstants.PPTX, Arrays.asList(PPT, PPTX, TIKA_MSOFFICE, TIKA_MSOFFICE_X));
put(FileTypeConstants.XLSX, Arrays.asList(XLS, XLSX, TIKA_MSOFFICE, TIKA_MSOFFICE_X)); put(FileTypeConstants.XLSX, Arrays.asList(XLS, XLSX, TIKA_MSOFFICE, TIKA_MSOFFICE_X));
put(FileTypeConstants.ODT, Arrays.asList(ODT)); put(FileTypeConstants.ODT, Arrays.asList(ODT));
put(FileTypeConstants.ODG, Arrays.asList(ODG));
put(FileTypeConstants.RTF, Arrays.asList(RTF)); put(FileTypeConstants.RTF, Arrays.asList(RTF));
put(FileTypeConstants.TXT, Arrays.asList(TXT)); put(FileTypeConstants.TXT, Arrays.asList(TXT));
put(FileTypeConstants.ODS, Arrays.asList(ODS)); put(FileTypeConstants.ODS, Arrays.asList(ODS));
@ -43,6 +49,7 @@ public class MimeTypeUtils {
put(FileTypeConstants.JPEG, Arrays.asList(JPEG)); put(FileTypeConstants.JPEG, Arrays.asList(JPEG));
put(FileTypeConstants.PNG, Arrays.asList(PNG)); put(FileTypeConstants.PNG, Arrays.asList(PNG));
put(FileTypeConstants.SVG, Arrays.asList(SVG)); put(FileTypeConstants.SVG, Arrays.asList(SVG));
put(FileTypeConstants.WEBP, Arrays.asList(WEBP));
} }
}; };
@ -71,8 +78,9 @@ public class MimeTypeUtils {
public List<String> getValidMimeTypes() { public List<String> getValidMimeTypes() {
List<String> validMimeTypes = Arrays.asList(XLS, XLSX, List<String> validMimeTypes = Arrays.asList(XLS, XLSX,
DOC, DOCX, PPT, PPTX, ODT, RTF, TXT, ODS, ODP, DOC, DOCX, PPT, PPTX, ODT, RTF, TXT, ODS, ODP, ODG,
PDF, JPEG, PNG, SVG, TIKA_MSOFFICE, TIKA_MSOFFICE_X PDF, JPEG, PNG, SVG, TIKA_MSOFFICE, TIKA_MSOFFICE_X,
WEBP
); );
return validMimeTypes; return validMimeTypes;
} }

View File

@ -40,7 +40,7 @@ public class SupportedDocumentFilter {
/* Get file extension - Perhaps try to rely on a more accurate method than an extension type ? */ /* Get file extension - Perhaps try to rely on a more accurate method than an extension type ? */
String extension = FilenameUtils.getExtension(presentationFile.getName()); String extension = FilenameUtils.getExtension(presentationFile.getName());
boolean supported = SupportedFileTypes.isFileSupported(extension); boolean supported = SupportedFileTypes.isPresentationMimeTypeValid(presentationFile, extension);
notifyProgressListener(supported, pres); notifyProgressListener(supported, pres);
if (supported) { if (supported) {
log.info("Received supported file {}", pres.getUploadedFile().getAbsolutePath()); log.info("Received supported file {}", pres.getUploadedFile().getAbsolutePath());

View File

@ -39,37 +39,21 @@ public final class SupportedFileTypes {
private static Logger log = LoggerFactory.getLogger(SupportedFileTypes.class); private static Logger log = LoggerFactory.getLogger(SupportedFileTypes.class);
private static MimeTypeUtils mimeTypeUtils = new MimeTypeUtils(); private static MimeTypeUtils mimeTypeUtils = new MimeTypeUtils();
private static final List<String> SUPPORTED_FILE_LIST = Collections.unmodifiableList(new ArrayList<String>(15) {
{
// Add all the supported files
add(XLS); add(XLSX); add(DOC); add(DOCX); add(PPT); add(PPTX);
add(ODT); add(RTF); add(TXT); add(ODS); add(ODP); add(PDF);
add(JPG); add(JPEG); add(PNG);
}
});
private static final List<String> OFFICE_FILE_LIST = Collections.unmodifiableList(new ArrayList<String>(11) { private static final List<String> OFFICE_FILE_LIST = Collections.unmodifiableList(new ArrayList<String>(11) {
{ {
// Add all Offile file types // Add all Offile file types
add(XLS); add(XLSX); add(DOC); add(DOCX); add(PPT); add(PPTX); add(XLS); add(XLSX); add(DOC); add(DOCX); add(PPT); add(PPTX);
add(ODT); add(RTF); add(TXT); add(ODS); add(ODP); add(ODT); add(RTF); add(TXT); add(ODS); add(ODP); add(ODG);
} }
}); });
private static final List<String> IMAGE_FILE_LIST = Collections.unmodifiableList(new ArrayList<String>(3) { private static final List<String> IMAGE_FILE_LIST = Collections.unmodifiableList(new ArrayList<String>(3) {
{ {
// Add all image file types // Add all image file types
add(JPEG); add(JPG); add(PNG); add(JPEG); add(JPG); add(PNG); add(WEBP); add(SVG);
} }
}); });
/*
* Returns if the file with extension is supported.
*/
public static boolean isFileSupported(String fileExtension) {
return SUPPORTED_FILE_LIST.contains(fileExtension.toLowerCase());
}
/* /*
* Returns if the Office file is supported. * Returns if the Office file is supported.
*/ */

View File

@ -821,6 +821,9 @@ public:
mirroredFromBBBCore: mirroredFromBBBCore:
uploadSizeMax: 30000000 uploadSizeMax: 30000000
uploadPagesMax: 200 uploadPagesMax: 200
# If the following mime-types list is changed, please, make sure to also change:
# bbb-common-web/src/main/java/org/bigbluebutton/presentation/MimeTypeUtils.java: L34 (and related files.)
# docs/docs/development/api.md: L1222
uploadValidMimeTypes: uploadValidMimeTypes:
- extension: .pdf - extension: .pdf
mime: application/pdf mime: application/pdf
@ -848,10 +851,6 @@ public:
mime: application/vnd.oasis.opendocument.presentation mime: application/vnd.oasis.opendocument.presentation
- extension: .odg - extension: .odg
mime: application/vnd.oasis.opendocument.graphics mime: application/vnd.oasis.opendocument.graphics
- extension: .odc
mime: application/vnd.oasis.opendocument.chart
- extension: .odi
mime: application/vnd.oasis.opendocument.image
- extension: .jpg - extension: .jpg
mime: image/jpeg mime: image/jpeg
- extension: .jpeg - extension: .jpeg
@ -860,6 +859,8 @@ public:
mime: image/png mime: image/png
- extension: .webp - extension: .webp
mime: image/webp mime: image/webp
- extension: .svg
mime: image/svg+xm
selectRandomUser: selectRandomUser:
enabled: true enabled: true
countdown: false countdown: false

View File

@ -509,7 +509,7 @@ See [Passing custom parameters to the client on join](/administration/customize/
### `POST` insertDocument ### `POST` insertDocument
This endpoint insert one or more documents into a running meeting via API call This endpoint insert one or more documents into a running meeting via API call.
**Resource URL:** **Resource URL:**
@ -1214,3 +1214,47 @@ For example, the application may be able to register a URL that BigBlueButton wo
- http&#58;//third-party-app/bbb-integ.php?event=meetingEnded&meetingID=abcd - http&#58;//third-party-app/bbb-integ.php?event=meetingEnded&meetingID=abcd
- http&#58;//third-party-app/bbb-integ.php?event=userLeft&userID=1234 - http&#58;//third-party-app/bbb-integ.php?event=userLeft&userID=1234
- http&#58;//third-party-app/bbb-integ.php?event=meetingEnded&meetingID=abcd - http&#58;//third-party-app/bbb-integ.php?event=meetingEnded&meetingID=abcd
## Other Topics
### Supported Document Types
#### PDF Documents
- PDF:
- .pdf
#### Office Documents
- Microsoft Word:
- .doc
- .docx
- Microsoft Excel:
- .xls
- .xlsx
- Microsoft PowerPoint:
- .ppt
- .pptx
- OpenDocument Formats:
- .odt (Text Document)
- .ods (Spreadsheet)
- .odp (Presentation)
- .odg (Graphics)
#### Image Files
- Common Image Formats:
- .jpg
- .jpeg
- .png
- .webp
- .svg
#### Text Files
- Rich Text Format:
- .rtf
- Plain Text:
- .txt
All these valid formats are also present in a list in the [back-end](https://github.com/bigbluebutton/bigbluebutton/blob/v2.7.10/bbb-common-web/src/main/java/org/bigbluebutton/presentation/MimeTypeUtils.java#L28-L47) and in the [front-end](https://github.com/bigbluebutton/bigbluebutton/blob/v2.7.10/bigbluebutton-html5/private/config/settings.yml#L824-L862) if more details are needed.