Merge pull request #11956 from gustavotrott/upload-maxsize-error
Creates a pubSub error message when Upload max size exceeded
This commit is contained in:
commit
ef337acbe6
@ -17,6 +17,7 @@ class PresentationPodHdlrs(implicit val context: ActorContext)
|
||||
with PresentationConversionUpdatePubMsgHdlr
|
||||
with PresentationPageGeneratedPubMsgHdlr
|
||||
with PresentationPageCountErrorPubMsgHdlr
|
||||
with PresentationUploadedFileTooLargeErrorPubMsgHdlr
|
||||
with PresentationUploadTokenReqMsgHdlr
|
||||
with ResizeAndMovePagePubMsgHdlr
|
||||
with SyncGetPresentationPodsMsgHdlr
|
||||
|
@ -43,7 +43,7 @@ trait PresentationUploadTokenReqMsgHdlr extends RightsManagementTrait {
|
||||
val envelope = BbbCoreEnvelope(PresentationUploadTokenSysPubMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(PresentationUploadTokenSysPubMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
|
||||
val body = PresentationUploadTokenSysPubMsgBody(msg.body.podId, token, msg.body.filename)
|
||||
val body = PresentationUploadTokenSysPubMsgBody(msg.body.podId, token, msg.body.filename, liveMeeting.props.meetingProp.intId)
|
||||
val event = PresentationUploadTokenSysPubMsg(header, body)
|
||||
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
|
||||
|
||||
|
@ -0,0 +1,36 @@
|
||||
package org.bigbluebutton.core.apps.presentationpod
|
||||
|
||||
import org.bigbluebutton.common2.msgs._
|
||||
import org.bigbluebutton.core.bus.MessageBus
|
||||
import org.bigbluebutton.core.domain.MeetingState2x
|
||||
import org.bigbluebutton.core.running.LiveMeeting
|
||||
|
||||
trait PresentationUploadedFileTooLargeErrorPubMsgHdlr {
|
||||
this: PresentationPodHdlrs =>
|
||||
|
||||
def handle(
|
||||
msg: PresentationUploadedFileTooLargeErrorSysPubMsg, state: MeetingState2x,
|
||||
liveMeeting: LiveMeeting, bus: MessageBus
|
||||
): MeetingState2x = {
|
||||
|
||||
def broadcastEvent(msg: PresentationUploadedFileTooLargeErrorSysPubMsg): Unit = {
|
||||
val routing = Routing.addMsgToClientRouting(
|
||||
MessageTypes.BROADCAST_TO_MEETING,
|
||||
liveMeeting.props.meetingProp.intId, msg.header.userId
|
||||
)
|
||||
val envelope = BbbCoreEnvelope(PresentationUploadedFileTooLargeErrorEvtMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(
|
||||
PresentationUploadedFileTooLargeErrorEvtMsg.NAME,
|
||||
liveMeeting.props.meetingProp.intId, msg.header.userId
|
||||
)
|
||||
|
||||
val body = PresentationUploadedFileTooLargeErrorEvtMsgBody(msg.body.podId, msg.body.messageKey, msg.body.code, msg.body.presentationName, msg.body.presentationToken, msg.body.fileSize, msg.body.maxFileSize)
|
||||
val event = PresentationUploadedFileTooLargeErrorEvtMsg(header, body)
|
||||
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
|
||||
bus.outGW.send(msgEvent)
|
||||
}
|
||||
|
||||
broadcastEvent(msg)
|
||||
state
|
||||
}
|
||||
}
|
@ -234,6 +234,8 @@ class ReceivedJsonMsgHandlerActor(
|
||||
routeGenericMsg[GetAllPresentationPodsReqMsg](envelope, jsonNode)
|
||||
case PreuploadedPresentationsSysPubMsg.NAME =>
|
||||
routeGenericMsg[PreuploadedPresentationsSysPubMsg](envelope, jsonNode)
|
||||
case PresentationUploadedFileTooLargeErrorSysPubMsg.NAME =>
|
||||
routeGenericMsg[PresentationUploadedFileTooLargeErrorSysPubMsg](envelope, jsonNode)
|
||||
case PresentationConversionUpdateSysPubMsg.NAME =>
|
||||
routeGenericMsg[PresentationConversionUpdateSysPubMsg](envelope, jsonNode)
|
||||
case PresentationPageCountErrorSysPubMsg.NAME =>
|
||||
|
@ -431,6 +431,7 @@ class MeetingActor(
|
||||
case m: RemovePresentationPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
|
||||
case m: SetPresentationDownloadablePubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
|
||||
case m: PresentationConversionUpdateSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
|
||||
case m: PresentationUploadedFileTooLargeErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
|
||||
case m: PresentationPageGeneratedSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
|
||||
case m: PresentationPageCountErrorSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
|
||||
case m: PresentationUploadTokenReqMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
|
||||
|
@ -120,6 +120,8 @@ class AnalyticsActor extends Actor with ActorLogging {
|
||||
case m: PresentationConversionUpdateEvtMsgBody => logMessage(msg)
|
||||
case m: PresentationPageCountErrorSysPubMsg => logMessage(msg)
|
||||
case m: PresentationPageCountErrorEvtMsg => logMessage(msg)
|
||||
case m: PresentationUploadedFileTooLargeErrorSysPubMsg => logMessage(msg)
|
||||
case m: PresentationUploadedFileTooLargeErrorEvtMsg => logMessage(msg)
|
||||
|
||||
// Group Chats
|
||||
case m: SendGroupChatMessageMsg => logMessage(msg)
|
||||
|
@ -147,6 +147,21 @@ case class PresentationConversionEndedSysMsgBody(
|
||||
presName: String
|
||||
)
|
||||
|
||||
object PresentationUploadedFileTooLargeErrorSysPubMsg { val NAME = "PresentationUploadedFileTooLargeErrorSysPubMsg" }
|
||||
case class PresentationUploadedFileTooLargeErrorSysPubMsg(
|
||||
header: BbbClientMsgHeader,
|
||||
body: PresentationUploadedFileTooLargeErrorSysPubMsgBody
|
||||
) extends StandardMsg
|
||||
case class PresentationUploadedFileTooLargeErrorSysPubMsgBody(
|
||||
podId: String,
|
||||
messageKey: String,
|
||||
code: String,
|
||||
presentationName: String,
|
||||
presentationToken: String,
|
||||
fileSize: Int,
|
||||
maxFileSize: Int
|
||||
)
|
||||
|
||||
// ------------ bbb-common-web to akka-apps ------------
|
||||
|
||||
// ------------ akka-apps to client ------------
|
||||
@ -198,6 +213,10 @@ case class PresentationPageConvertedEventMsgBody(
|
||||
page: PresentationPageVO
|
||||
)
|
||||
|
||||
object PresentationUploadedFileTooLargeErrorEvtMsg { val NAME = "PresentationUploadedFileTooLargeErrorEvtMsg" }
|
||||
case class PresentationUploadedFileTooLargeErrorEvtMsg(header: BbbClientMsgHeader, body: PresentationUploadedFileTooLargeErrorEvtMsgBody) extends BbbCoreMsg
|
||||
case class PresentationUploadedFileTooLargeErrorEvtMsgBody(podId: String, messageKey: String, code: String, presentationName: String, presentationToken: String, fileSize: Int, maxFileSize: Int)
|
||||
|
||||
object PresentationConversionRequestReceivedEventMsg { val NAME = "PresentationConversionRequestReceivedEventMsg" }
|
||||
case class PresentationConversionRequestReceivedEventMsg(
|
||||
header: BbbClientMsgHeader,
|
||||
@ -281,5 +300,5 @@ case class SyncGetPresentationPodsRespMsgBody(pods: Vector[PresentationPodVO])
|
||||
// ------------ akka-apps to bbb-common-web ------------
|
||||
object PresentationUploadTokenSysPubMsg { val NAME = "PresentationUploadTokenSysPubMsg" }
|
||||
case class PresentationUploadTokenSysPubMsg(header: BbbClientMsgHeader, body: PresentationUploadTokenSysPubMsgBody) extends BbbCoreMsg
|
||||
case class PresentationUploadTokenSysPubMsgBody(podId: String, authzToken: String, filename: String)
|
||||
case class PresentationUploadTokenSysPubMsgBody(podId: String, authzToken: String, filename: String, meetingId: String)
|
||||
// ------------ akka-apps to bbb-common-web ------------
|
||||
|
@ -86,6 +86,7 @@ import org.bigbluebutton.api2.IBbbWebApiGWApp;
|
||||
import org.bigbluebutton.api2.domain.UploadedTrack;
|
||||
import org.bigbluebutton.common2.redis.RedisStorageService;
|
||||
import org.bigbluebutton.presentation.PresentationUrlDownloadService;
|
||||
import org.bigbluebutton.presentation.imp.SwfSlidesGenerationProgressNotifier;
|
||||
import org.bigbluebutton.web.services.WaitingGuestCleanupTimerTask;
|
||||
import org.bigbluebutton.web.services.UserCleanupTimerTask;
|
||||
import org.bigbluebutton.web.services.EnteredUserCleanupTimerTask;
|
||||
@ -120,6 +121,7 @@ public class MeetingService implements MessageListener {
|
||||
private RedisStorageService storeService;
|
||||
private CallbackUrlService callbackUrlService;
|
||||
private HTML5LoadBalancingService html5LoadBalancingService;
|
||||
private SwfSlidesGenerationProgressNotifier notifier;
|
||||
|
||||
private long usersTimeout;
|
||||
private long enteredUsersTimeout;
|
||||
@ -314,6 +316,18 @@ public class MeetingService implements MessageListener {
|
||||
return valid;
|
||||
}
|
||||
|
||||
public PresentationUploadToken getPresentationUploadToken(String authzToken) {
|
||||
if(uploadAuthzTokens.containsKey(authzToken)) {
|
||||
return uploadAuthzTokens.get(authzToken);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendPresentationUploadMaxFilesizeMessage(PresentationUploadToken presUploadToken, int uploadedFileSize, int maxUploadFileSize) {
|
||||
notifier.sendUploadFileTooLargeMessage(presUploadToken, uploadedFileSize, maxUploadFileSize);
|
||||
}
|
||||
|
||||
private void removeUserSessions(String meetingId) {
|
||||
Iterator<Map.Entry<String, UserSession>> iterator = sessions.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
@ -1241,4 +1255,9 @@ public class MeetingService implements MessageListener {
|
||||
public void setEnteredUsersTimeout(long value) {
|
||||
enteredUsersTimeout = value;
|
||||
}
|
||||
|
||||
public void setSwfSlidesGenerationProgressNotifier(SwfSlidesGenerationProgressNotifier notifier) {
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,10 +4,12 @@ public class PresentationUploadToken implements IMessage {
|
||||
public final String podId;
|
||||
public final String authzToken;
|
||||
public final String filename;
|
||||
public final String meetingId;
|
||||
|
||||
public PresentationUploadToken(String podId, String authzToken, String filename) {
|
||||
public PresentationUploadToken(String podId, String authzToken, String filename, String meetingId) {
|
||||
this.podId = podId;
|
||||
this.authzToken = authzToken;
|
||||
this.filename = filename;
|
||||
this.meetingId = meetingId;
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ public class ConversionMessageConstants {
|
||||
public static final String OFFICE_DOC_CONVERSION_SUCCESS_KEY = "OFFICE_DOC_CONVERSION_SUCCESS";
|
||||
public static final String OFFICE_DOC_CONVERSION_FAILED_KEY = "OFFICE_DOC_CONVERSION_FAILED";
|
||||
public static final String OFFICE_DOC_CONVERSION_INVALID_KEY = "OFFICE_DOC_CONVERSION_INVALID";
|
||||
public static final String FILE_TOO_LARGE = "FILE_TOO_LARGE";
|
||||
public static final String SUPPORTED_DOCUMENT_KEY = "SUPPORTED_DOCUMENT";
|
||||
public static final String UNSUPPORTED_DOCUMENT_KEY = "UNSUPPORTED_DOCUMENT";
|
||||
public static final String PAGE_COUNT_FAILED_KEY = "PAGE_COUNT_FAILED";
|
||||
|
@ -18,14 +18,12 @@
|
||||
|
||||
package org.bigbluebutton.presentation.imp;
|
||||
|
||||
import org.bigbluebutton.api.messaging.messages.PresentationUploadToken;
|
||||
import org.bigbluebutton.api2.IBbbWebApiGWApp;
|
||||
import org.bigbluebutton.presentation.ConversionMessageConstants;
|
||||
import org.bigbluebutton.presentation.GeneratedSlidesInfoHelper;
|
||||
import org.bigbluebutton.presentation.UploadedPresentation;
|
||||
import org.bigbluebutton.presentation.messages.DocPageCompletedProgress;
|
||||
import org.bigbluebutton.presentation.messages.DocPageGeneratedProgress;
|
||||
import org.bigbluebutton.presentation.messages.IDocConversionMsg;
|
||||
import org.bigbluebutton.presentation.messages.OfficeDocConversionProgress;
|
||||
import org.bigbluebutton.presentation.messages.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -41,6 +39,17 @@ public class SwfSlidesGenerationProgressNotifier {
|
||||
messagingService.sendDocConversionMsg(msg);
|
||||
}
|
||||
|
||||
public void sendUploadFileTooLargeMessage(PresentationUploadToken pres, int uploadedFileSize, int maxUploadFileSize) {
|
||||
UploadFileTooLargeMessage progress = new UploadFileTooLargeMessage(
|
||||
pres.podId,
|
||||
pres.meetingId,
|
||||
pres.filename,
|
||||
pres.authzToken,
|
||||
ConversionMessageConstants.FILE_TOO_LARGE,
|
||||
uploadedFileSize,
|
||||
maxUploadFileSize);
|
||||
messagingService.sendDocConversionMsg(progress);
|
||||
}
|
||||
|
||||
public void sendConversionUpdateMessage(int slidesCompleted, UploadedPresentation pres, int pageGenerated) {
|
||||
DocPageGeneratedProgress progress = new DocPageGeneratedProgress(pres.getPodId(),
|
||||
|
@ -0,0 +1,27 @@
|
||||
package org.bigbluebutton.presentation.messages;
|
||||
|
||||
public class UploadFileTooLargeMessage implements IDocConversionMsg {
|
||||
public final String podId;
|
||||
public final String meetingId;
|
||||
public final String filename;
|
||||
public final String authzToken;
|
||||
public final String key;
|
||||
public final Integer uploadedFileSize;
|
||||
public final Integer maxUploadFileSize;
|
||||
|
||||
public UploadFileTooLargeMessage(String podId,
|
||||
String meetingId,
|
||||
String filename,
|
||||
String authzToken,
|
||||
String key,
|
||||
Integer uploadedFileSize,
|
||||
Integer maxUploadFileSize) {
|
||||
this.podId = podId;
|
||||
this.meetingId = meetingId;
|
||||
this.filename = filename;
|
||||
this.authzToken = authzToken;
|
||||
this.key = key;
|
||||
this.uploadedFileSize = uploadedFileSize;
|
||||
this.maxUploadFileSize = maxUploadFileSize;
|
||||
}
|
||||
}
|
@ -312,6 +312,9 @@ class BbbWebApiGWApp(
|
||||
} else if (msg.isInstanceOf[DocPageConversionStarted]) {
|
||||
val event = MsgBuilder.buildPresentationPageConversionStartedSysMsg(msg.asInstanceOf[DocPageConversionStarted])
|
||||
msgToAkkaAppsEventBus.publish(MsgToAkkaApps(toAkkaAppsChannel, event))
|
||||
} else if (msg.isInstanceOf[UploadFileTooLargeMessage]) {
|
||||
val event = MsgBuilder.buildPresentationUploadedFileTooLargeErrorSysMsg(msg.asInstanceOf[UploadFileTooLargeMessage])
|
||||
msgToAkkaAppsEventBus.publish(MsgToAkkaApps(toAkkaAppsChannel, event))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,4 +280,17 @@ object MsgBuilder {
|
||||
val req = DeletedRecordingSysMsg(header, body)
|
||||
BbbCommonEnvCoreMsg(envelope, req)
|
||||
}
|
||||
|
||||
def buildPresentationUploadedFileTooLargeErrorSysMsg(msg: UploadFileTooLargeMessage): BbbCommonEnvCoreMsg = {
|
||||
val routing = collection.immutable.HashMap("sender" -> "bbb-web")
|
||||
val envelope = BbbCoreEnvelope(PresentationUploadedFileTooLargeErrorSysPubMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(PresentationUploadedFileTooLargeErrorSysPubMsg.NAME, msg.meetingId, msg.authzToken)
|
||||
|
||||
val body = PresentationUploadedFileTooLargeErrorSysPubMsgBody(podId = msg.podId, messageKey = msg.key,
|
||||
code = msg.key, presentationName = msg.filename, presentationToken = msg.authzToken, fileSize = msg.uploadedFileSize.intValue(), maxFileSize = msg.maxUploadFileSize)
|
||||
|
||||
val req = PresentationUploadedFileTooLargeErrorSysPubMsg(header, body)
|
||||
BbbCommonEnvCoreMsg(envelope, req)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ class OldMeetingMsgHdlrActor(val olgMsgGW: OldMessageReceivedGW)
|
||||
}
|
||||
|
||||
def handlePresentationUploadTokenSysPubMsg(msg: PresentationUploadTokenSysPubMsg): Unit = {
|
||||
olgMsgGW.handle(new PresentationUploadToken(msg.body.podId, msg.body.authzToken, msg.body.filename))
|
||||
olgMsgGW.handle(new PresentationUploadToken(msg.body.podId, msg.body.authzToken, msg.body.filename, msg.body.meetingId))
|
||||
}
|
||||
|
||||
def handleGuestsWaitingApprovedEvtMsg(msg: GuestsWaitingApprovedEvtMsg): Unit = {
|
||||
|
@ -20,8 +20,8 @@
|
||||
# Workaround IE refusal to set cookies in iframe
|
||||
add_header P3P 'CP="No P3P policy available"';
|
||||
|
||||
# Allow 30M uploaded presentation document.
|
||||
client_max_body_size 30m;
|
||||
# high limit for presentation as bbb-web will reject upload if larger than configured
|
||||
client_max_body_size 1000m;
|
||||
client_body_buffer_size 128k;
|
||||
|
||||
proxy_connect_timeout 90;
|
||||
@ -38,7 +38,10 @@
|
||||
proxy_request_buffering off;
|
||||
|
||||
# Send a sub-request to allow bbb-web to refuse before loading
|
||||
# If file is larger than configured bbb-web will return with code 403 and Header: x-file-too-large = 1
|
||||
auth_request /bigbluebutton/presentation/checkPresentation;
|
||||
error_page 403 = @error403;
|
||||
auth_request_set $file_too_large_header $upstream_http_x_file_too_large;
|
||||
|
||||
}
|
||||
|
||||
@ -66,8 +69,8 @@
|
||||
proxy_set_header Content-Length "";
|
||||
proxy_set_header X-Original-Content-Length $http_content_length;
|
||||
|
||||
# Allow 30M uploaded presentation document.
|
||||
client_max_body_size 30m;
|
||||
# high limit for presentation as bbb-web will reject upload if larger than configured
|
||||
client_max_body_size 1000m;
|
||||
client_body_buffer_size 128k;
|
||||
|
||||
proxy_pass_request_body off;
|
||||
@ -138,3 +141,11 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
location @error403 {
|
||||
if ($file_too_large_header = '1') {
|
||||
return 413;
|
||||
}
|
||||
|
||||
return 403;
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<property name="callbackUrlService" ref="callbackUrlService"/>
|
||||
<property name="usersTimeout" value="${usersTimeout}"/>
|
||||
<property name="enteredUsersTimeout" value="${enteredUsersTimeout}"/>
|
||||
<property name="swfSlidesGenerationProgressNotifier" ref="swfSlidesGenerationProgressNotifier"/>
|
||||
</bean>
|
||||
|
||||
<bean id="oldMessageReceivedGW" class="org.bigbluebutton.api2.bus.OldMessageReceivedGW">
|
||||
|
@ -19,6 +19,7 @@
|
||||
package org.bigbluebutton.web.controllers
|
||||
|
||||
import grails.converters.*
|
||||
import org.bigbluebutton.api.messaging.messages.PresentationUploadToken
|
||||
import org.grails.web.mime.DefaultMimeUtility
|
||||
import org.bigbluebutton.api.ParamsProcessorUtil;
|
||||
|
||||
@ -62,8 +63,14 @@ class PresentationController {
|
||||
response.outputStream << 'upload-success';
|
||||
} else {
|
||||
log.debug "NO SUCCESS \n"
|
||||
|
||||
//Send upload error message
|
||||
PresentationUploadToken presUploadToken = meetingService.getPresentationUploadToken(presentationToken);
|
||||
meetingService.sendPresentationUploadMaxFilesizeMessage(presUploadToken, originalContentLength, maxUploadFileSize as int);
|
||||
|
||||
response.setStatus(404);
|
||||
response.addHeader("Cache-Control", "no-cache")
|
||||
response.addHeader("x-file-too-large", "1")
|
||||
response.contentType = 'plain/text'
|
||||
response.outputStream << 'file-empty';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user