[Issue-18924]

This commit is contained in:
GuiLeme 2023-10-17 10:21:51 -03:00
parent f046ec20af
commit d7d228d047

View File

@ -21,6 +21,7 @@ package org.bigbluebutton.web.controllers
import com.google.gson.Gson
import grails.web.context.ServletContextHolder
import groovy.json.JsonBuilder
import groovy.xml.MarkupBuilder
import org.apache.commons.codec.binary.Base64
import org.apache.commons.codec.digest.DigestUtils
import org.apache.commons.io.FilenameUtils
@ -1378,6 +1379,27 @@ class ApiController {
Boolean isDefaultPresentationCurrent = false;
def listOfPresentation = []
def presentationListHasCurrent = false
Boolean hasPresentationUrlInParameter = false
String[] pu = request.getParameterMap().get("presentationURL")
if (pu != null) {
String presentationURL = pu[0]
hasPresentationUrlInParameter = true
def xmlString = new StringWriter()
def xml = new MarkupBuilder(xmlString)
xml.document (
removable: "true",
downloadable: "false",
url: presentationURL,
filename: extractFilenameFromUrl(presentationURL),
name: extractFilenameFromUrl(presentationURL)
)
def parsedXml = new XmlSlurper().parseText(xmlString.toString())
listOfPresentation << parsedXml
}
// This part of the code is responsible for organize the presentations in a certain order
// It selects the one that has the current=true, and put it in the 0th place.
@ -1387,10 +1409,17 @@ class ApiController {
log.warn("Insert Document API called without a payload - ignoring")
return;
}
listOfPresentation << [name: "default", current: true];
if (hasPresentationUrlInParameter) {
if (!preUploadedPresentationOverrideDefault) {
listOfPresentation << [name: "default", current: false]
}
} else {
listOfPresentation << [name: "default", current: true]
}
} else {
def xml = new XmlSlurper().parseText(requestBody);
Boolean hasCurrent = false;
Boolean hasCurrent = hasPresentationUrlInParameter;
xml.children().each { module ->
log.debug("module config found: [${module.@name}]");
@ -1478,6 +1507,10 @@ class ApiController {
return true
}
def extractFilenameFromUrl(String url) {
return url.split('/')[-1]
}
def processDocumentFromRawBytes(bytes, presOrigFilename, meetingId, current, isDownloadable, isRemovable,
isInitialPresentation) {
def uploadFailed = false