兼容node环境

This commit is contained in:
黄心宇 2024-01-13 09:51:34 +08:00
parent 9294c5f120
commit 6465a77744
3 changed files with 8 additions and 9 deletions

View File

@ -98,7 +98,6 @@ export function initAxiosInterceptors(props) {
if (response.data.status === 404) {
let responseURL = (response && response.request) ? response.request.responseURL:'';
// 组织和个人的拥有情况404不跳转
console.log(responseURL)
if (responseURL.indexOf('/api/users/') === -1 && responseURL.indexOf('/api/organizations/') === -1 ) {
// 邀请页面不进行404跳转
if( window.location.pathname.includes('/invite') && (responseURL.includes('/simple.json')||responseURL.includes('/detail.json')||responseURL.includes('/menu_list.json'))){

View File

@ -295,13 +295,13 @@ export function turnbar(str){
let s = str;
if(s && s.length>0){
if(s.indexOf("%")>-1){
s = s.replaceAll('%','_25');
s = s.split('%').join('_25');
}
if(s.indexOf("#")>-1){
s = s.replaceAll('#','%23');
s = s.split('#').join('%23');
}
if(s.indexOf("/")>-1){
s = s.replaceAll('/','%2F');
s = s.split('/').join('%2F');
}
}
return s;
@ -310,13 +310,13 @@ export function returnbar(str){
let s = str;
if(s && s.length>0){
if(str.indexOf("_25")>-1){
s = s.replaceAll('_25','%');
s = s.split('_25').join('%');
}
if(s.indexOf("%23")>-1){
s = s.replaceAll('%23','#');
s = s.split('%23').join('#');
}
if(s.indexOf("%2F")>-1){
s = s.replaceAll('%2F','/');
s = s.split('%2F').join('/');
}
}
return s;

View File

@ -94,7 +94,7 @@ export default ({
for(var x=0;x<issues.length;x++){
let item = issues[x];
let content = item.id ? `<a href="`+`/${owner}/${projectsId}/issues/${item.project_issues_index}`+`">#${item.project_issues_index}:${item.subject}</a>` : `<span>#${item.project_issues_index}(已删除)</span>`;
rs = rs.replaceAll(`<a href="`+`/${owner}/${projectsId}/issues/${item.project_issues_index}`+`">#${item.project_issues_index}</a>`,content);
rs = rs.split(`<a href="`+`/${owner}/${projectsId}/issues/${item.project_issues_index}`+`">#${item.project_issues_index}</a>`).join(content);
}
}
@ -103,7 +103,7 @@ export default ({
return renderToString(_unescape(expression) || '', { displayMode: type === 'block', throwOnError: false, output: 'html' })
})
rs = dompurify.sanitize(rs.replace(/▁/g, "▁▁▁"))
rs = rs.replaceAll('<img ', `<img onerror="javascript:this.src='${ imgError }';"`)
rs = rs.split('<img ').join(`<img onerror="javascript:this.src='${ imgError }';"`) // replaceall
resetMathExpressions()
return rs
}, [str,issues]);