|  |  |  | @ -9,11 +9,13 @@ module GitHelper | 
			
		
	
		
			
				
					|  |  |  |  |   # 版本库文件内容,带转码 | 
			
		
	
		
			
				
					|  |  |  |  |   def git_fle_content(repo_path, path) | 
			
		
	
		
			
				
					|  |  |  |  |     begin | 
			
		
	
		
			
				
					|  |  |  |  |       content = GitService.file_content(repo_path: repo_path, path: path)["content"] | 
			
		
	
		
			
				
					|  |  |  |  |       logger.info("@@@@@@@@@@@@@@@@@@#{content}") | 
			
		
	
		
			
				
					|  |  |  |  |       content = GitService.file_content(repo_path: repo_path, path: path) | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |       logger.info("@@@@@@@@@@@@@@@@@@#{content}") | 
			
		
	
		
			
				
					|  |  |  |  |       decode_content = nil | 
			
		
	
		
			
				
					|  |  |  |  |       if content.present? | 
			
		
	
		
			
				
					|  |  |  |  |         content = content["content"]   #6.24 -hs 这个为新增,因为当实训题里含有选择题时,这里会报错,undefined method `[]' for nil:NilClass | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         content = Base64.decode64(content) | 
			
		
	
		
			
				
					|  |  |  |  |         cd = CharDet.detect(content) | 
			
		
	
		
			
				
					|  |  |  |  |         logger.info "encoding: #{cd['encoding']} confidence: #{cd['confidence']}" | 
			
		
	
	
		
			
				
					|  |  |  | @ -27,6 +29,7 @@ module GitHelper | 
			
		
	
		
			
				
					|  |  |  |  |       end | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |       decode_content | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     rescue Exception => e | 
			
		
	
		
			
				
					|  |  |  |  |       uid_logger_error(e.message) | 
			
		
	
		
			
				
					|  |  |  |  |       raise Educoder::TipException.new("文档内容获取异常") | 
			
		
	
	
		
			
				
					|  |  |  | 
 |