diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-05-10 09:44:50 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-05-10 09:44:50 +0200 |
commit | e8e72aa9101b1c4b7e321dd3f17dcc9462f34a8f (patch) | |
tree | 0eec63cb17f7ad60130474a0bbdcbfaaa281d884 /core | |
parent | 1fb7be42e55236c2663b52f89a85b54d81ae08ba (diff) | |
parent | 254576e1f7f5ec610ddbd9de81005397191cf52f (diff) | |
download | nextcloud-server-e8e72aa9101b1c4b7e321dd3f17dcc9462f34a8f.tar.gz nextcloud-server-e8e72aa9101b1c4b7e321dd3f17dcc9462f34a8f.zip |
Merge pull request #24434 from owncloud/permalinks
Permalinks
Diffstat (limited to 'core')
-rw-r--r-- | core/js/js.js | 42 | ||||
-rw-r--r-- | core/routes.php | 6 |
2 files changed, 45 insertions, 3 deletions
diff --git a/core/js/js.js b/core/js/js.js index 541ce003a7b..1c49d38f950 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -2050,8 +2050,9 @@ OC.Util.History = { * * @param params to append to the URL, can be either a string * or a map + * @param {boolean} [replace=false] whether to replace instead of pushing */ - pushState: function(params) { + _pushState: function(params, replace) { var strParams; if (typeof(params) === 'string') { strParams = params; @@ -2061,7 +2062,11 @@ OC.Util.History = { } if (window.history.pushState) { var url = location.pathname + '?' + strParams; - window.history.pushState(params, '', url); + if (replace) { + window.history.replaceState(params, '', url); + } else { + window.history.pushState(params, '', url); + } } // use URL hash for IE8 else { @@ -2073,6 +2078,32 @@ OC.Util.History = { }, /** + * Push the current URL parameters to the history stack + * and change the visible URL. + * Note: this includes a workaround for IE8/IE9 that uses + * the hash part instead of the search part. + * + * @param params to append to the URL, can be either a string + * or a map + */ + pushState: function(params) { + return this._pushState(params, false); + }, + + /** + * Push the current URL parameters to the history stack + * and change the visible URL. + * Note: this includes a workaround for IE8/IE9 that uses + * the hash part instead of the search part. + * + * @param params to append to the URL, can be either a string + * or a map + */ + replaceState: function(params) { + return this._pushState(params, true); + }, + + /** * Add a popstate handler * * @param handler function @@ -2129,7 +2160,12 @@ OC.Util.History = { if (!this._handlers.length) { return; } - params = (e && e.state) || this.parseUrlQuery() || {}; + params = (e && e.state); + if (_.isString(params)) { + params = OC.parseQueryString(params); + } else if (!params) { + params = this.parseUrlQuery() || {}; + } for (var i = 0; i < this._handlers.length; i++) { this._handlers[i](params); } diff --git a/core/routes.php b/core/routes.php index 2b7a19f7d86..a9c800af4e8 100644 --- a/core/routes.php +++ b/core/routes.php @@ -108,6 +108,12 @@ $this->create('core_ajax_preview', '/core/preview.png') $this->create('core_ajax_update', '/core/ajax/update.php') ->actionInclude('core/ajax/update.php'); +// File routes +$this->create('files.viewcontroller.showFile', '/f/{fileId}')->action(function($urlParams) { + $app = new \OCA\Files\AppInfo\Application($urlParams); + $app->dispatch('ViewController', 'showFile'); +}); + // Sharing routes $this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function($urlParams) { $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |