Skip to content

Instantly share code, notes, and snippets.

@allanharris
Created May 16, 2012 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allanharris/2711927 to your computer and use it in GitHub Desktop.
Save allanharris/2711927 to your computer and use it in GitHub Desktop.
webui\src\main\java\com\taskadapter\webui\Exporter.java
if (destinationDataHolder.getData() instanceof MSPConfig) {
// implementation of http://www.hostedredmine.com/issues/68820
// quite ugly
// TODO check for XSS attack with wrong paths...
MSPConfig config = (MSPConfig) destinationDataHolder.getData();
if (config.getOutputAbsoluteFilePath().isEmpty()) {
String userName = navigator.getServices().getAuthenticator().getUserName();
FileManager fm = new FileManager();
File f = fm.getUserFolder(userName);
String newPath = String.format("%s/%s-%s.xml", f.getAbsolutePath(), sourceDataHolder.getType(), destinationDataHolder.getType());
config.setOutputAbsoluteFilePath(newPath);
config.setInputAbsoluteFilePath(newPath);
}
} else {
destinationDataHolder.getData().validateForSave();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment