From bd534236d053f977af452a509188d91921af52ba Mon Sep 17 00:00:00 2001 From: Terrtia Date: Mon, 20 Apr 2020 09:30:45 +0200 Subject: [PATCH] fix: [show item UI] return 404 --- var/www/modules/showpaste/Flask_showpaste.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/var/www/modules/showpaste/Flask_showpaste.py b/var/www/modules/showpaste/Flask_showpaste.py index ee4be6ad..52525843 100644 --- a/var/www/modules/showpaste/Flask_showpaste.py +++ b/var/www/modules/showpaste/Flask_showpaste.py @@ -9,7 +9,7 @@ import json import os import sys import flask -from flask import Flask, render_template, jsonify, request, Blueprint, make_response, Response, send_from_directory, redirect, url_for +from flask import Flask, render_template, jsonify, request, Blueprint, make_response, Response, send_from_directory, redirect, url_for, abort from Role_Manager import login_admin, login_analyst, login_read_only, no_cache from flask_login import login_required @@ -72,7 +72,11 @@ def showpaste(content_range, requested_path): vt_enabled = Flask_config.vt_enabled - paste = Paste.Paste(requested_path) + try: + paste = Paste.Paste(requested_path) + except FileNotFoundError: + abort(404) + p_date = str(paste._get_p_date()) p_date = p_date[6:]+'/'+p_date[4:6]+'/'+p_date[0:4] p_source = paste.p_source