[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1467: Added application/zip to allowed content types in import

revision-diff.txt (1.88 KB)

much better :slight_smile:

ยทยทยท

On 22 February 2010 14:55, <noreply@launchpad.net> wrote:

------------------------------------------------------------
revno: 1467
committer: Lars Helge Oeverland <larshelge@gmail.com>
branch nick: trunk
timestamp: Mon 2010-02-22 15:53:23 +0100
message:
Added application/zip to allowed content types in import
modified:
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/ImportAction.java

--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.

=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/ImportAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/ImportAction.java 2010-02-22 09:37:31 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/ImportAction.java 2010-02-22 14:53:23 +0000
@@ -33,10 +33,13 @@
import static org.hisp.dhis.util.InternalProcessUtil.PROCESS_KEY_IMPORT;
import static org.hisp.dhis.util.InternalProcessUtil.setCurrentRunningProcess;

+import static org.hisp.dhis.system.util.ConversionUtils.getList;
+
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
+import java.util.List;

import org.amplecode.cave.process.ProcessCoordinator;
import org.amplecode.cave.process.ProcessExecutor;
@@ -64,6 +67,12 @@

private static final Log log = LogFactory\.getLog\( ImportAction\.class \);

+ private static final List<String> ALLOWED_CONTENT_TYPES = getList(
+ "application/x-zip-compressed",
+ "application/zip",
+ "application/x-gzip",
+ "text/xml" );
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -205,9 +214,7 @@
// accept zip, gzip or uncompressed xml
// TODO: check cross-browser content type strings

- if ( !( ( contentType.equals( "application/x-zip-compressed" ) ) ||
- contentType.equals( "application/x-gzip") ||
- contentType.equals( "text/xml")))
+ if ( !ALLOWED_CONTENT_TYPES.contains( contentType ) )
{
message = i18n.getString( "file_type_not_allowed" );

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp