1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 09:21:54 +00:00

fix drop file (#2809)

This commit is contained in:
C_Q
2019-01-11 10:58:10 +08:00
committed by Daniel Pan
parent 6117d7edb2
commit 1e4ba68f7d
2 changed files with 6 additions and 6 deletions

View File

@@ -123,24 +123,23 @@ class EditorUtilities {
var url;
if (fileNode.type === 'file') {
if (fileNode.isImage()) {
url = serviceUrl + '/lib/' + repoID + '/file' + encodeURIComponent(fileNode.path()) + '?raw=1';
url = serviceUrl + '/lib/' + repoID + '/file' + Utils.encodePath(fileNode.path()) + '?raw=1';
} else {
url = serviceUrl + '/wiki/lib/' + repoID + '/file' + encodeURIComponent(fileNode.path());
url = serviceUrl + '/lib/' + repoID + '/file' + Utils.encodePath(fileNode.path());
}
} else {
url = serviceUrl + '/wiki/lib/' + repoID + encodeURIComponent(fileNode.path());
url = serviceUrl + '/library/' + repoID + '/' + encodeURIComponent(repoName) + Utils.encodePath(fileNode.path());
}
return url;
}
isInternalFileLink(url) {
var re = new RegExp(this.serviceUrl + '/wiki/lib/[0-9a-f-]{36}/file.*');
var re = new RegExp(this.serviceUrl + '/lib/[0-9a-f-]{36}/file.*');
return re.test(url);
}
isInternalDirLink(url) {
var re = new RegExp(serviceUrl + '/wiki/lib/' + '[0-9a-f\-]{36}.*');
var re = new RegExp(serviceUrl + '/library/' + '[0-9a-f\-]{36}.*');
return re.test(url);
}