You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openmeetings.apache.org by Maxim Solodovnik <so...@gmail.com> on 2012/04/06 17:55:55 UTC

Re: svn commit: r1310411 - in /incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler: AbstractUploadController.java BackupImportController.java UploadController.java

Hello Sebastian,

I have fixed OPENMEETINGS-104 using filename transcoding (hack)
maybe you know how to specify encoding inside flash file upload? I was
unable to find appropriate method in openlaszlo ...

Thanks in advance

On Fri, Apr 6, 2012 at 22:50, <so...@apache.org> wrote:

> Author: solomax
> Date: Fri Apr  6 15:50:45 2012
> New Revision: 1310411
>
> URL: http://svn.apache.org/viewvc?rev=1310411&view=rev
> Log:
> OPENMEETINGS-104 file name encoding is fixed (using hack)
>
> Modified:
>
>  incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/AbstractUploadController.java
>
>  incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/BackupImportController.java
>
>  incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/UploadController.java
>
> Modified:
> incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/AbstractUploadController.java
> URL:
> http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/AbstractUploadController.java?rev=1310411&r1=1310410&r2=1310411&view=diff
>
> ==============================================================================
> ---
> incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/AbstractUploadController.java
> (original)
> +++
> incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/AbstractUploadController.java
> Fri Apr  6 15:50:45 2012
> @@ -39,13 +39,13 @@ public abstract class AbstractUploadCont
>                Long userId;
>                String sid;
>                String publicSID;
> +               String filename;
>        }
>
>     protected UploadInfo validate(HttpServletRequest request, boolean
> admin) throws ServletException {
>        UploadInfo info = new UploadInfo();
>                log.debug("Starting validate");
>                try {
> -
>                        String sid = request.getParameter("sid");
>                        if (sid == null) {
>                                throw new ServletException("SID Missing");
> @@ -74,6 +74,8 @@ public abstract class AbstractUploadCont
>
>                        MultipartHttpServletRequest multipartRequest =
> (MultipartHttpServletRequest)request;
>                        MultipartFile multipartFile =
> multipartRequest.getFile("Filedata");
> +                       //FIXME encoding HACK
> +                       info.filename = new String
> (multipartFile.getOriginalFilename().getBytes ("iso-8859-1"), "UTF-8");
>                        long fileSize = multipartFile.getSize();
>                        long maxSize =
> ImportHelper.getMaxUploadSize(cfgManagement);
>                        log.debug("uploading " + fileSize + " bytes");
>
> Modified:
> incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/BackupImportController.java
> URL:
> http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/BackupImportController.java?rev=1310411&r1=1310410&r2=1310411&view=diff
>
> ==============================================================================
> ---
> incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/BackupImportController.java
> (original)
> +++
> incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/BackupImportController.java
> Fri Apr  6 15:50:45 2012
> @@ -424,7 +424,7 @@ public class BackupImportController exte
>                        hs.put("message", "library");
>                        hs.put("action", "import");
>                        hs.put("error", "");
> -                       hs.put("fileName",
> multipartFile.getOriginalFilename());
> +                       hs.put("fileName", info.filename);
>
>
>  scopeApplicationAdapter.sendMessageWithClientByPublicSID(
>                                        hs, info.publicSID);
>
> Modified:
> incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/UploadController.java
> URL:
> http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/UploadController.java?rev=1310411&r1=1310410&r2=1310411&view=diff
>
> ==============================================================================
> ---
> incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/UploadController.java
> (original)
> +++
> incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/UploadController.java
> Fri Apr  6 15:50:45 2012
> @@ -86,12 +86,11 @@ public class UploadController extends Ab
>
>                        MultipartFile multipartFile = info.file;
>                        InputStream is = multipartFile.getInputStream();
> -                       String fileSystemName =
> multipartFile.getOriginalFilename();
> -                       log.debug("fileSystemName: " + fileSystemName);
> +                       log.debug("fileSystemName: " + info.filename);
>
>                        HashMap<String, HashMap<String, String>>
> returnError = fileProcessor
>                                        .processFile(info.userId,
> room_id_to_Store, isOwner, is,
> -                                                       parentFolderId,
> fileSystemName, current_dir, hs, 0L, ""); // externalFilesId,
> +                                                       parentFolderId,
> info.filename, current_dir, hs, 0L, ""); // externalFilesId,
>
>
>                          // externalType
>
>                        HashMap<String, String> returnAttributes =
> returnError
> @@ -139,7 +138,7 @@ public class UploadController extends Ab
>
>                        MultipartFile multipartFile = info.file;
>                        InputStream is = multipartFile.getInputStream();
> -                       String fileSystemName =
> multipartFile.getOriginalFilename();
> +                       String fileSystemName = info.filename;
>                        fileSystemName =
> StringUtils.deleteWhitespace(fileSystemName);
>
>                        // Flash cannot read the response of an upload
>
>
>


-- 
WBR
Maxim aka solomax