diff --git a/app.py b/app.py index 11b64de..a2e8c50 100644 --- a/app.py +++ b/app.py @@ -12,7 +12,7 @@ from sqlalchemy.exc import IntegrityError from werkzeug.exceptions import BadRequest from werkzeug.security import generate_password_hash, check_password_hash from werkzeug.utils import secure_filename -from flask import Flask, render_template, redirect, url_for, request, flash, session, jsonify +from flask import Flask, abort, render_template, redirect, url_for, request, flash, session, jsonify from flask_sqlalchemy import SQLAlchemy from flask_bcrypt import Bcrypt from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user, current_user @@ -636,16 +636,15 @@ async def upload_video(): description = form.description.data if video_file and video_thumbnail: - if not allowed_file(video_file.filename, app.config['ALLOWED_VIDEO_EXTENSIONS']): return redirect(url_for('upload_video')) - if not check_file_size(video_file, app.config['MAX_VIDEO_SIZE']): + if not await check_file_size(video_file, app.config['MAX_VIDEO_SIZE']): return redirect(url_for('upload_video')) if not allowed_file(video_thumbnail.filename, app.config['ALLOWED_IMAGE_EXTENSIONS']): return redirect(url_for('upload_video')) - video_filename = generate_unique_filename(video_file.filename, app.config['UPLOAD_FOLDER']['videos']) - thumbnail_filename = generate_unique_filename(video_thumbnail.filename, app.config['UPLOAD_FOLDER']['thumbnails']) + video_filename = await generate_unique_filename(video_file.filename, app.config['UPLOAD_FOLDER']['videos']) + thumbnail_filename = await generate_unique_filename(video_thumbnail.filename, app.config['UPLOAD_FOLDER']['thumbnails']) video_path = os.path.join(app.config['UPLOAD_FOLDER']['videos'], video_filename) thumbnail_path = os.path.join(app.config['UPLOAD_FOLDER']['thumbnails'], thumbnail_filename) @@ -1571,4 +1570,4 @@ def buy_item(item_id): if __name__ == '__main__': with app.app_context(): db.create_all() - app.run(debug=False) \ No newline at end of file + app.run(debug=True) \ No newline at end of file diff --git a/templates/video_edit.html b/templates/video_edit.html index d733cc5..78770dc 100644 --- a/templates/video_edit.html +++ b/templates/video_edit.html @@ -22,7 +22,7 @@ {{ form.video_thumbnail(class="file-input") }} {% if video.video_thumbnail_file %} - Thumbnail preview + Thumbnail preview {% endif %} @@ -42,4 +42,4 @@ Cancel - + \ No newline at end of file