diff options
author | kondou <kondou@ts.unde.re> | 2014-04-07 23:16:25 +0200 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2014-09-04 15:23:53 +0200 |
commit | 0f2ad9862e98e00fdc250bf8405bf6404d40b1ed (patch) | |
tree | 8ad4be8240caedd163f810018b0c7fe0b5d388b0 /core | |
parent | 1a7df3323391f6d6f7ef04de2687b3a566ab6351 (diff) | |
download | nextcloud-server-0f2ad9862e98e00fdc250bf8405bf6404d40b1ed.tar.gz nextcloud-server-0f2ad9862e98e00fdc250bf8405bf6404d40b1ed.zip |
Initial work on shorter links
Diffstat (limited to 'core')
-rw-r--r-- | core/ajax/share.php | 2 | ||||
-rw-r--r-- | core/js/share.js | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php index c6da79a8a42..536f0e2ebd8 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -46,6 +46,8 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo (!empty($_POST['expirationDate']) ? new \DateTime($_POST['expirationDate']) : null) ); + $token = base_convert($token, 16, 36); + if (is_string($token)) { OC_JSON::success(array('data' => array('token' => $token))); } else { diff --git a/core/js/share.js b/core/js/share.js index f1652370d35..d00b5f1ccf9 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -663,6 +663,8 @@ OC.Share={ // TODO: use oc webroot ? var link = parent.location.protocol+'//'+location.host+OC.linkTo('', 'public.php')+'?service=files&'+type+'='+encodeURIComponent(file); } else { + // convert the token to base36 + //token = parseInt(token, 16).toString(36); //TODO add path param when showing a link to file in a subfolder of a public link share var service=''; if(linkSharetype === 'folder' || linkSharetype === 'file'){ @@ -672,8 +674,11 @@ OC.Share={ } // TODO: use oc webroot ? - var link = parent.location.protocol+'//'+location.host+OC.linkTo('', 'public.php')+'?service='+service+'&t='+token; - + if (service !== 'files') { + var link = parent.location.protocol+'//'+location.host+OC.linkTo('', 'public.php')+'?service='+service+'&t='+token; + } else { + var link = parent.location.protocol+'//'+location.host+OC.linkTo('', 's.php')+'?t='+token; + } } $('#linkText').val(link); $('#linkText').show('blind'); |