diff --git a/app/services/git_service.rb b/app/services/git_service.rb index d2889c034..544e830a4 100644 --- a/app/services/git_service.rb +++ b/app/services/git_service.rb @@ -29,7 +29,7 @@ class GitService https = Net::HTTP.new(uri.host, uri.port) https.use_ssl = root_url.start_with?('https') req = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' => 'text/plain;charset=utf-8'}) - req.body = JSON.parse(params).to_s + req.body = params.to_json res = https.request(req) body = res.body logger.info("--uri_exec: .....res is #{body}") diff --git a/app/services/jupyter_service.rb b/app/services/jupyter_service.rb index 32c2047c4..879ac1d93 100644 --- a/app/services/jupyter_service.rb +++ b/app/services/jupyter_service.rb @@ -89,7 +89,7 @@ module JupyterService raise("获取文件内容失败:#{response.status}") end - content = response.body + content = response.body.force_encoding('utf-8') c = GitService.update_file(repo_path: shixun.repo_path, file_path: "01.ipynb", @@ -117,7 +117,7 @@ module JupyterService raise("获取文件内容失败:#{response.status}") end - content = response.body + content = response.body.force_encoding('utf-8') c = GitService.update_file(repo_path: myshixun.repo_path, file_path: "01.ipynb",