diff --git a/app/controllers/pdfviewer_controller.rb b/app/controllers/pdfviewer_controller.rb index 8df99abd..5a24595b 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, alert: "Document not found" + end end end \ No newline at end of file