changeset 0:efaf6b50a6bc

Uploaded
author pitagora
date Tue, 12 Aug 2014 07:34:26 -0400
parents
children 3f3b545df9d9
files filebrowser/filebrowser.xml filebrowser/link_path_2.pl
diffstat 2 files changed, 53 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/filebrowser.xml	Tue Aug 12 07:34:26 2014 -0400
@@ -0,0 +1,22 @@
+<xml version="1.0"?>
+<tool name="Local File" id="local_file_browser" tool_type="data_source">
+    <description>browser</description>
+    <command interpreter="perl">link_path_2.pl $source $dest</command>
+    <inputs action="http://localhost/filebrowser/main.html" check_values="false" method="get">
+        <display>go to Local File Browser $GALAXY_URL</display>
+        <param name="GALAXY_URL" type="baseurl" value="/tool_runner" />
+        <param name="tool_id" type="hidden" value="local_file_browser" />
+    </inputs>
+    <request_param_translation>
+        <request_param galaxy_name="URL_method" remote_name="URL_method" missing="post" />
+        <request_param galaxy_name="URL" remote_name="URL" missing="" />
+        <request_param galaxy_name="dbkey" remote_name="db" missing="?" />
+        <request_param galaxy_name="file_name" remote_name="name" missing="no_name" />
+        <request_param galaxy_name="source" remote_name="path" missing="" label="Original File Path" />
+    </request_param_translation>
+    <uihints minwidth="800"/>
+    <outputs>
+        <data name="dest" format="data" label="${tool.name}: ${file_name}"/>
+    </outputs>
+    <options sanitize="False" refresh="True"/>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filebrowser/link_path_2.pl	Tue Aug 12 07:34:26 2014 -0400
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+# THIS TOOL HAS BEEN DEPRECATED IN FAVOR OF THE galaxy_import.pl AND gcpd.pl METHOD
+# WHICH DON'T REQUIRE SETTING METADATA MANUALLY FOR EACH FILE.
+
+use strict;
+use File::Copy;
+
+# CONFIG
+my @allowed_paths = ('/');
+
+# ARGS
+my ($src, $dest)=@ARGV;
+die("Absolute path required\n") unless $src =~ /^\//;
+die("Paths containing '..' are disallowed\n") if $src =~ /\/\.\.\//;
+my $ok=0;
+foreach my $dir (@allowed_paths) {
+    my $re="^$dir";
+    $re =~ s/\//\\\//g;
+    if ($src =~ /$re/) {
+        $ok=1;
+        last;
+    }
+}
+die("Not an allowed source path\n") unless $ok;
+
+# CP
+# if ($src =~ /\.gz$/)
+unlink($dest);
+system("cp $src $dest");
+exit;