diff --git a/app/controllers/pdfviewer_controller.rb b/app/controllers/pdfviewer_controller.rb index 8df99abd..335ab606 100644 --- a/app/controllers/pdfviewer_controller.rb +++ b/app/controllers/pdfviewer_controller.rb @@ -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 \ No newline at end of file