mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
28 lines
748 B
JavaScript
28 lines
748 B
JavaScript
import {siteRoot, historyRepoID, fileServerRoot } from './constants';
|
|
import { Utils } from './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' + Utils.encodePath(options.filePath) + '?dl=1';
|
|
break;
|
|
default:
|
|
url = '';
|
|
break;
|
|
}
|
|
return url;
|
|
}
|
|
|
|
}
|
|
|
|
export default URLDecorator; |