airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndo...@apache.org
Subject [1/2] airavata-php-gateway git commit: Download link security changes to output and input files in experiment summary
Date Tue, 03 Nov 2015 16:46:45 GMT
Repository: airavata-php-gateway
Updated Branches:
  refs/heads/master dcaecbfbe -> db2d8060b


Download link security changes to output and input files in experiment summary


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/3a917b66
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/3a917b66
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/3a917b66

Branch: refs/heads/master
Commit: 3a917b665e164bdd3640821d2b023e6120477313
Parents: 8eeb7be
Author: Nipun Doshi <Nipun Doshi>
Authored: Tue Nov 3 11:44:05 2015 -0500
Committer: Nipun Doshi <Nipun Doshi>
Committed: Tue Nov 3 11:44:05 2015 -0500

----------------------------------------------------------------------
 app/libraries/ExperimentUtilities.php | 12 ++++++------
 app/routes.php                        |  5 +++++
 2 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3a917b66/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 4f997d0..ba266b9 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -72,11 +72,11 @@ class ExperimentUtilities
             $matchingAppInput = null;
 
             if ($input->type == DataType::URI && empty($input->metaData)) {
-                $explode = explode('/', $input->value);
+                $inputArray = explode('/', $input->value);
                 echo '<p><a target="_blank"
-                        href="' . URL::to("/") . "/.." . Config::get('pga_config.airavata')['experiment-data-dir']
-                    . "/" . $explode[sizeof($explode) - 2] . '/' . $explode[sizeof($explode)
- 1] . '">' .
-                    $explode[sizeof($explode) - 1] . '
+                        href="' . URL::to("/") . '/download/' . $inputArray[ count($inputArray)-2]
. '/' . 
+                $inputArray[ count($inputArray)-1] . '">' .
+                    $inputArray[ count($inputArray)-1] . '
                 <span class="glyphicon glyphicon-new-window"></span></a></p>';
             }elseif($input->type == DataType::URI && !empty($input->metaData)
                 && json_decode($input->metaData)->location=="remote"){
@@ -628,8 +628,8 @@ class ExperimentUtilities
                         $outputPathArray = explode("/", $outputPath);
 
                         echo '<p>' . $output->name . ' : ' . '<a target="_blank"
-                                href="' . URL::to("/") . "/.." . str_replace(Config::get('pga_config.airavata')['experiment-data-absolute-path'],
-                                Config::get('pga_config.airavata')['experiment-data-dir'],
$output->value) . '">' .
+                                href="' . URL::to("/") . '/download/' . $outputArray[ count($outputArray)-2]
. '/' . 
+                $outputArray[ count($outputArray)-1] . '">' .
                             $outputPathArray[sizeof($outputPathArray) - 1] . ' <span class="glyphicon
glyphicon-new-window"></span></a></p>';
                     }
                 } elseif ($output->type == DataType::STRING) {

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3a917b66/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index 138f010..b43a9f5 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -87,6 +87,11 @@ Route::get("experiment/getQueueView", "ExperimentController@getQueueView");
 Route::get("experiment/browse", "ExperimentController@browseView");
 
 Route::post("experiment/browse", "ExperimentController@browseView");
+
+Route::get("download/{exp_folder}/{exp_file}", function( $exp_folder, $exp_file){
+    $downloadLink = URL::to('/') . '/..' . Config::get('pga_config.airavata')['experiment-data-dir']
. '/' . $exp_folder . '/' . $exp_file;
+    return Response::download( $downloadLink);
+});
 /*
  * Compute Resources Routes
 */


Mime
View raw message