- replace invalid chars from presentation name and uploaded filename

git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@1353 af16638f-c34d-0410-8cfa-b39d5352b314
This commit is contained in:
Richard Alam 2009-05-01 17:56:59 +00:00
parent 21f9530a3b
commit 34e533ecbd

View File

@ -56,10 +56,12 @@ class PresentationController {
def file = request.getFile('fileUpload')
if(!file.empty) {
flash.message = 'Your file has been uploaded'
def presentationName = params.presentation_name.replace(' ', '-')
// Replace any character other than a (A-Z, a-z, 0-9, _ or .) with a - (dash).
def notValiedCharsRegExp = /[^0-9a-zA-Z_\.]/
def presentationName = params.presentation_name.replaceAll(notValiedCharsRegExp, '-')
File uploadDir = presentationService.uploadedPresentationDirectory(params.conference, params.room, presentationName)
def newFilename = file.getOriginalFilename().replace(' ', '-')
def newFilename = file.getOriginalFilename().replaceAll(notValiedCharsRegExp, '-')
def pres = new File( uploadDir.absolutePath + File.separatorChar + newFilename )
file.transferTo( pres )
presentationService.processUploadedPresentation(params.conference, params.room, presentationName, pres)