From d50ce2c97d947ac461505a7b314b96cf4289ca21 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Mar 2020 21:35:39 +0800 Subject: [PATCH] =?UTF-8?q?url=E5=AE=89=E5=85=A8=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 4 ++-- app/views/users/videos/_video.json.jbuilder | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1039a648a..6d5688078 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -28,9 +28,9 @@ module ApplicationHelper end # MD5加密 - def base64_encode(content) + def url_base64_encode(content) return nil if content.blank? - Base64.encode64(content) + Base64.urlsafe_encode64(content) end def graduation_navigation graduation diff --git a/app/views/users/videos/_video.json.jbuilder b/app/views/users/videos/_video.json.jbuilder index ac030ce12..707c0a5cf 100644 --- a/app/views/users/videos/_video.json.jbuilder +++ b/app/views/users/videos/_video.json.jbuilder @@ -1,6 +1,6 @@ json.extract! video, :id, :title, :cover_url, :file_url, :play_url, :vv, :user_id, :transcoded -json.play_url base64_encode(video.play_url) -json.file_url base64_encode(video.file_url) +json.play_url url_base64_encode(video.play_url) +json.file_url url_base64_encode(video.file_url) json.play_duration video.video_play_duration json.published_at video.display_published_at json.created_at video.display_created_at