Skip to content

Commit

Permalink
Adding a check if a document exists, redirecting to homepage with not…
Browse files Browse the repository at this point in the history
…ice if it doesn't
  • Loading branch information
dfmurphy-wpi committed Oct 26, 2021
1 parent c34428d commit b148ff3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/controllers/pdfviewer_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
class PdfviewerController < ApplicationController
layout "pdfviewer"
def index
@id = params[:id]
@parent_id = FileSet.find(@id).parent_id
if FileSet.exists?(params[:id])
@id = params[:id]
@parent_id = FileSet.find(@id).parent_id
else
redirect_to root_path, notice: "Document not found"
end
end
end

0 comments on commit b148ff3

Please sign in to comment.