diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index d08729c39..781462a21 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -263,15 +263,18 @@ class CoderRootDirectory extends Component{ http_url:branchLastCommit && branchLastCommit.http_url, isSpin: true }) - const { pathname } = this.props.location; - if(pathname && pathname.indexOf("/filesurl/")>-1){ - let url =pathname.split("filesurl/")[1]; - this.setState({ - filePath:url - }) - this.getFileDetail(url,branchLastCommit && branchLastCommit.name); - }else{ - this.getProjectRoot( branchLastCommit && branchLastCommit.name ); + if(branchLastCommit){ + const { pathname } = this.props.location; + if(pathname && pathname.indexOf("/filesurl/")>-1){ + let url =pathname.split("filesurl/")[1]; + this.setState({ + filePath:url + }) + this.getFileDetail(url, branchLastCommit.name); + }else{ + this.getProjectRoot( branchLastCommit.name ); + } + // this.props.history.location.search.replace( branchLastCommit.name ); } } render(){ diff --git a/src/forge/quillForEditor/index.js b/src/forge/quillForEditor/index.js index 497082602..b7adc7c3e 100644 --- a/src/forge/quillForEditor/index.js +++ b/src/forge/quillForEditor/index.js @@ -19,7 +19,8 @@ import deepEqual from './deepEqual.js' import { fetchUploadImage } from '../../services/ojService.js'; import ImageBlot from './ImageBlot'; import FillBlot from './FillBlot'; -import LinkBlot from './link-blot' +import LinkBlot from './link-blot'; +import { getImageUrl } from 'educoder'; var Size = Quill.import('attributors/style/size'); Size.whitelist = ['14px', '16px', '18px', '20px', false]; var fonts = ['Microsoft-YaHei', 'SimSun', 'SimHei', 'KaiTi', 'FangSong']; @@ -174,7 +175,7 @@ function QuillForEditor({ const result = await fetchUploadImage(formData); // 获取上传图片的url if (result.data && result.data.id) { - fileUrl = (`https://testforgeplus.trustie.net/api/attachments/${result.data.id}`); + fileUrl = (getImageUrl(`api/attachments/${result.data.id}`)); } // 根据id获取文件路径 const { width, height } = imgAttrs;