1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 08:28:11 +00:00
Files
seahub/frontend/src/utils/url-decorator.js
shanshuirenjia 3a67d78016 clean package.json and repair code style (#2411)
* clean package.json and repair code style

* update css style

* repair bug
2018-09-29 18:32:53 +08:00

28 lines
771 B
JavaScript

import {siteRoot, historyRepoID, fileServerRoot } from '../components/constants';
import { encodePath } from '../components/utils';
class URLDecorator {
static getUrl(options) {
let url = '';
let params = '';
switch (options.type) {
case 'download_historic_file':
params = 'p=' + options.filePath;
url = siteRoot + 'repo/' + historyRepoID + '/' + options.objID + '/download?' + params;
break;
case 'download_dir_zip_url':
url = fileServerRoot + 'zip/' + options.token;
break;
case 'download_file_url':
url = siteRoot + 'lib/' + options.repoID + '/file' + encodePath(options.filePath) + '?dl=1';
break;
default:
url = '';
break;
}
return url;
}
}
export default URLDecorator;