mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-12 13:24:52 +00:00
bug repair (#2835)
This commit is contained in:
@@ -892,7 +892,7 @@ class Wiki extends Component {
|
||||
}
|
||||
|
||||
isInternalMarkdownLink(url) {
|
||||
var re = new RegExp(siteRoot + 'library/' + repoID + '.*/*.md$');
|
||||
var re = new RegExp(siteRoot + 'lib/' + repoID + '.*\.md$');
|
||||
return re.test(url);
|
||||
}
|
||||
|
||||
@@ -902,7 +902,7 @@ class Wiki extends Component {
|
||||
}
|
||||
|
||||
getPathFromInternalMarkdownLink(url) {
|
||||
var re = new RegExp(siteRoot + 'library/' + repoID + '/' + slug + '(.*/*.md)');
|
||||
var re = new RegExp(siteRoot + 'lib/' + repoID + '/file' + '(.*\.md)');
|
||||
var array = re.exec(url);
|
||||
var path = decodeURIComponent(array[1]);
|
||||
return path;
|
||||
@@ -913,15 +913,6 @@ class Wiki extends Component {
|
||||
var array = re.exec(url);
|
||||
var path = decodeURIComponent(array[1]);
|
||||
|
||||
var index = path.substring(1).indexOf('/');
|
||||
var dirPath = path.substring(index + 1);
|
||||
re = new RegExp('(^/.*)');
|
||||
if (re.test(dirPath)) {
|
||||
path = dirPath;
|
||||
} else {
|
||||
path = '/' + dirPath;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
@@ -468,7 +468,7 @@ class Wiki extends Component {
|
||||
}
|
||||
|
||||
isInternalMarkdownLink(url) {
|
||||
var re = new RegExp(siteRoot + 'library/' + repoID + '.*/*.md$');
|
||||
var re = new RegExp(siteRoot + 'lib/' + repoID + '.*\.md$');
|
||||
return re.test(url);
|
||||
}
|
||||
|
||||
@@ -478,26 +478,17 @@ class Wiki extends Component {
|
||||
}
|
||||
|
||||
getPathFromInternalMarkdownLink(url) {
|
||||
var re = new RegExp(siteRoot + 'library/' + repoID + '/' + slug + '(.*/*.md)');
|
||||
var re = new RegExp(siteRoot + 'lib/' + repoID + '/file' + '(.*\.md)');
|
||||
var array = re.exec(url);
|
||||
var path = decodeURIComponent(array[1]);
|
||||
return path;
|
||||
}
|
||||
|
||||
getPathFromInternalDirLink(url) {
|
||||
var re = new RegExp(siteRoot + 'library/' + repoID + '/' + slug + '(/.*)');
|
||||
var re = new RegExp(siteRoot + 'library/' + repoID + '/' + slug + '(.*)');
|
||||
var array = re.exec(url);
|
||||
var path = decodeURIComponent(array[1]);
|
||||
|
||||
var index = path.substring(1).indexOf('/');
|
||||
var dirPath = path.substring(index + 1);
|
||||
re = new RegExp('(^/.*)');
|
||||
if (re.test(dirPath)) {
|
||||
path = dirPath;
|
||||
} else {
|
||||
path = '/' + dirPath;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user