Closed ja669nle2bil closed 5 months ago
VERY_FIRST_VER if 'pdf_file_path' in session: pdf_path = session['pdf_file_path'] print('pdf_path received ON /validate-pdf:', request.form['pdf_path'])
if 'pdf_path' not in request.form:
return jsonify({"error": "No pdf_path provided for validartion"})
pdf_path = request.form['pdf_path']
# new log: 17:22-10-04
logging.debug("pdf_path received in validate_pdf route: %s", pdf_path)
#Debugging17:25-10-04
if not os.path.exists(pdf_path):
print('File does not exist:', pdf_path)
#log 15:11-10-04
logging.error("File does not exist after upload (/validate-pdf):", pdf_path)
return jsonify({"error": "PDF file not found after upload(/validate-pdf)"}), 404
# test 14:48-10-04
try:
if not is_pdf_size_valid(pdf_path):
logging.error("File is empty or corrupt:", pdf_path)
return jsonify({"error": "PDF size exceeds limit"})
except Exception as e:
logging.exception("Unexpected error during validation:", e)
return jsonify({"error": "Internal server error"}), 500
return jsonify({"isValid": True})
resolved -latest commit
Undefined after leaving 'target' route . ..