@@ -428,93 +428,6 @@ public void addNavTrail(NavTree tree)
428428 }
429429 }
430430
431- @ RequiresPermission (ReadPermission .class )
432- @ IgnoresTermsOfUse
433- public static class DownloadTempImageAction extends ExportAction <TempImageAction >
434- {
435- @ Override
436- public void export (TempImageAction form , HttpServletResponse response , BindException errors ) throws Exception
437- {
438- File targetFile ;
439- FileLike tempDirRoot = new FileSystemLike .Builder (FileUtil .getTempDirectory ()).root ();
440- if (!(tempDirRoot .getFileSystem ().isDescendant (tempDirRoot , new File (form .getDirectory ()).toURI ())))
441- {
442- throw new FileNotFoundException ("Directory '" + form .getDirectory () + "' is not the descendant of '" + tempDirRoot .getPath () + "'" );
443- }
444- FileLike parentDirFileLike = form .getDirectory () == null ? tempDirRoot : tempDirRoot .resolveFile (new Path (form .getDirectory ()));
445- File parentDir = FileSystemLike .toFile (parentDirFileLike );
446-
447- if (!(parentDirFileLike .getFileSystem ().isDescendant (parentDirFileLike , new File (form .getFileName ()).toURI ())))
448- {
449- throw new FileNotFoundException ("File '" + form .getFileName () + "' is not the descendant of '" + parentDirFileLike .getPath () + "'" );
450- }
451-
452- targetFile = FileSystemLike .toFile (parentDirFileLike .resolveChild (form .getFileName ()));
453- targetFile = FileUtil .getAbsoluteCaseSensitiveFile (targetFile );
454-
455- if (!NetworkDrive .exists (targetFile ))
456- {
457- throw new FileNotFoundException ("Could not find file: " + targetFile .getPath ());
458- }
459-
460- if (parentDir .listFiles () == null )
461- {
462- throw new FileNotFoundException ("Unable to list the contents of folder: " + parentDir .getPath ());
463- }
464-
465- PageFlowUtil .streamFile (response , targetFile , false );
466-
467- //the file will be recreated, so delete upon running
468- FileUtils .deleteQuietly (targetFile );
469-
470- //if the folder if empty, remove it too. other simultaneous requests might have deleted this folder before we get to it
471- if (parentDir != null && parentDir .exists ())
472- {
473- File [] children = parentDir .listFiles ();
474- if (children != null && children .length == 0 && !parentDir .equals (FileUtil .getTempDirectory ()))
475- {
476- FileUtils .deleteQuietly (parentDir ); //the Images folder
477- File parent = parentDir .getParentFile ();
478- FileUtils .deleteQuietly (parent ); //the file's folder
479-
480- if (parent != null && parent .getParentFile () != null )
481- {
482- File [] children2 = parent .getParentFile ().listFiles ();
483- if (children2 != null && children2 .length == 0 )
484- FileUtils .deleteQuietly (parent .getParentFile ()); //the file's folder
485- }
486- }
487- }
488- }
489- }
490-
491- @ RequiresPermission (ReadPermission .class )
492- @ IgnoresTermsOfUse
493- public static class ConvertTextToFileAction extends ExportAction <ConvertTextToFileForm >
494- {
495- @ Override
496- public void export (ConvertTextToFileForm form , HttpServletResponse response , BindException errors ) throws Exception
497- {
498- String text = form .getText ();
499-
500- if (text == null )
501- {
502- errors .reject (ERROR_MSG , "Need to provide text" );
503- return ;
504- }
505- if (form .getFileName () == null )
506- {
507- errors .reject (ERROR_MSG , "Need to provide a filename" );
508- return ;
509- }
510-
511- Map <String , String > headers = new HashMap <>();
512-
513- PageFlowUtil .prepareResponseForFile (response , headers , form .getFileName (), true );
514- response .getOutputStream ().print (text );
515- }
516- }
517-
518431 @ RequiresPermission (ReadPermission .class )
519432 public static class FindOrphanFilesAction extends ConfirmAction <Object >
520433 {
@@ -1670,58 +1583,6 @@ public void setZipFileName(String zipFileName)
16701583 }
16711584 }
16721585
1673- public static class ConvertTextToFileForm
1674- {
1675- private String _text ;
1676- private String _fileName ;
1677-
1678- public String getText ()
1679- {
1680- return _text ;
1681- }
1682-
1683- public void setText (String text )
1684- {
1685- _text = text ;
1686- }
1687-
1688- public String getFileName ()
1689- {
1690- return _fileName ;
1691- }
1692-
1693- public void setFileName (String fileName )
1694- {
1695- _fileName = fileName ;
1696- }
1697- }
1698-
1699- public static class TempImageAction
1700- {
1701- String _fileName ;
1702- String _directory ;
1703-
1704- public String getFileName ()
1705- {
1706- return _fileName ;
1707- }
1708-
1709- public void setFileName (String fileName )
1710- {
1711- _fileName = fileName ;
1712- }
1713-
1714- public String getDirectory ()
1715- {
1716- return _directory ;
1717- }
1718-
1719- public void setDirectory (String directory )
1720- {
1721- _directory = directory ;
1722- }
1723- }
1724-
17251586 public static class FastqcForm
17261587 {
17271588 private String [] _filenames ;
0 commit comments