summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-02-09 01:28:25 -0800
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-02-09 01:28:25 -0800
commit5a15221910aa8307d58ae89fc8cb3555663b36d8 (patch)
treeb84b2f0ca3a65b10542cffa0ec95c94427ca8f9e
parent39183255205cd07028296f82da04d0fae19d3248 (diff)
parented1dc3e064e4ca64fc2db2cecbd1f6bd48242b7b (diff)
downloadnextcloud-server-5a15221910aa8307d58ae89fc8cb3555663b36d8.tar.gz
nextcloud-server-5a15221910aa8307d58ae89fc8cb3555663b36d8.zip
Merge pull request #1550 from owncloud/fix-files-download-links
Fix files router download links
-rw-r--r--apps/files/index.php2
-rw-r--r--apps/files/js/filelist.js2
-rw-r--r--lib/public/util.php14
3 files changed, 16 insertions, 2 deletions
diff --git a/apps/files/index.php b/apps/files/index.php
index 104cf1a55d3..434e98c6ea8 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -92,7 +92,7 @@ foreach (explode('/', $dir) as $i) {
$list = new OCP\Template('files', 'part.list', '');
$list->assign('files', $files, false);
$list->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir=', false);
-$list->assign('downloadURL', OCP\Util::linkTo('files', 'download.php') . '?file=', false);
+$list->assign('downloadURL', OCP\Util::linkToRoute('download', array('file' => '/')), false);
$list->assign('disableSharing', false);
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
$breadcrumbNav->assign('breadcrumb', $breadcrumb, false);
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 9c794d24e4f..e4c71d41b2a 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -15,7 +15,7 @@ var FileList={
extension=false;
}
html+='<td class="filename" style="background-image:url('+img+')"><input type="checkbox" />';
- html+='<a class="name" href="download.php?file='+$('#dir').val().replace(/</, '&lt;').replace(/>/, '&gt;')+'/'+escapeHTML(name)+'"><span class="nametext">'+escapeHTML(basename);
+ html+='<a class="name" href="' +OC.Router.generate('download', { file: $('#dir').val()+'/'+name }) +'"><span class="nametext">'+escapeHTML(basename);
if(extension){
html+='<span class="extension">'+escapeHTML(extension)+'</span>';
}
diff --git a/lib/public/util.php b/lib/public/util.php
index 968ca891b4c..5f6ede4460e 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -148,6 +148,20 @@ class Util {
}
/**
+ * @brief Creates an url using a defined route
+ * @param $route
+ * @param array $parameters
+ * @return
+ * @internal param array $args with param=>value, will be appended to the returned url
+ * @returns the url
+ *
+ * Returns a url to the given app and file.
+ */
+ public static function linkToRoute( $route, $parameters = array() ) {
+ return \OC_Helper::linkToRoute($route, $parameters);
+ }
+
+ /**
* @brief Creates an url
* @param string $app app
* @param string $file file