Ejemplo n.º 1
0
def preview(file_hash):
    paste_file = File.get_by_filehash(file_hash)
    if not paste_file:
        path = get_file_path(file_hash)
        if not os.path.exists(path) and (not os.path.islink(path)):
            return abort(404)

        paste_file = File.create_by_old_paste(file_hash)
        db.session.add(paste_file)
        db.session.commit()

    return render_template('success.html', p=paste_file)