reademe转义

This commit is contained in:
黄心宇 2024-05-24 18:16:22 +08:00
parent 381a7e9a0f
commit 2f43c3f74c
2 changed files with 2 additions and 1 deletions

View File

@ -63,7 +63,7 @@ function CoderDepot(props){
const [ website , setWebsite ] = useState(projectDetail.website ||undefined);
const [ lesson_url , setLessonUrl ] = useState(projectDetail.lesson_url || undefined);
const [ topics, setTopics] = useState(projectDetail.topics || undefined);
const [ readme , setReadme ] = useState(projectReadMe || undefined);
const [ readme , setReadme ] = useState((projectReadMe && JSON.parse(decodeURIComponent(projectReadMe))) || undefined);
const [ defaultBranch , setDefaultBranch ] = useState(projectDetail.default_branch || undefined);
const [ editReadme , setEditReadme ] = useState(false);
const [ pullsFlag , setPullsFlag ] = useState(true);

View File

@ -65,6 +65,7 @@ export const setProjectReadMe = ({ owner,projectsId, branch }) => {
return (dispatch) => {
return getProjectReadMe(owner, projectsId, branch).then(res => {
if (res && res.data) {
res.data = encodeURIComponent( JSON.stringify(res.data) )
dispatch({
type: types.GET_PROJECT_README,
payload: res.data