-
Notifications
You must be signed in to change notification settings - Fork 3
show.html.erb #77 ダウンロードリンク追加 #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
19fde88
e7d0fac
e97249f
33724b7
89007c7
64a3d13
888f1fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,6 +18,9 @@ | |||||||||||||||||
| <div>追加日: <%= @archive.created_at.in_time_zone('Tokyo').strftime('%Y-%m-%d %H:%M') %></div> | ||||||||||||||||||
| <div>状態: <%= @archive.status %></div> | ||||||||||||||||||
| </div> | ||||||||||||||||||
| <div> | ||||||||||||||||||
| <%= link_to("ダウンロード", @archive.video, download: @archive.title ) %> | ||||||||||||||||||
| </div> | ||||||||||||||||||
|
Comment on lines
+21
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a video presence check to prevent 404 errors. The download link should only be displayed when a video is attached, similar to how the video player is conditionally rendered. Consider wrapping the download link in a conditional check: - <div>
- <%= link_to("ダウンロード", @archive.video, download: @archive.title ) %>
- </div>
+ <% if @archive.video.attached? %>
+ <div>
+ <%= link_to("ダウンロード", @archive.video, download: @archive.title ) %>
+ </div>
+ <% end %>📝 Committable suggestion
Suggested change
💡 Codebase verification Authorization check required for video downloads The codebase currently lacks any authentication or authorization mechanisms:
This confirms the original review comment's concern about implementing proper authorization. The video downloads are currently accessible to anyone who has the URL. Key locations requiring attention:
🔗 Analysis chainVerify download authorization. Ensure that only authorized users can download videos. Consider adding authorization checks. Let's check if there are any existing authorization checks in the codebase: Consider implementing authorization using one of these approaches:
🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Look for authorization-related code
echo "Checking for authorization mechanisms..."
rg -l "before_action|authenticate|authorize|current_user" app/controllers/
rg -l "cancan|pundit|devise" Gemfile
Length of output: 245 Script: #!/bin/bash
# Let's check the content of archives_controller.rb to see the authorization mechanisms
echo "Checking ArchivesController content..."
cat app/controllers/archives_controller.rb
# Let's also check for any application-wide authentication in application_controller
echo -e "\nChecking ApplicationController content..."
cat app/controllers/application_controller.rb
Length of output: 2239 |
||||||||||||||||||
| </div> | ||||||||||||||||||
| <div class="article__log"> | ||||||||||||||||||
| <h3>ログ</h3> | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider sanitizing the filename for download.
The archive title is used directly as the download filename, which could cause issues if it contains invalid characters.
Consider sanitizing the filename:
You'll need to implement a helper method like: