fix: Share-View Loeschen nutzt jetzt Papierkorb statt hartem Delete
- share_delete_file nutzt _trash_recursive() statt db.session.delete() - Geloeschte Dateien aus Share-Links landen im Papierkorb des Eigentümers - Share-Dateiliste filtert getrashte Dateien aus (is_trashed=False) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
82f3091f2e
commit
67118a34fd
|
|
@ -696,7 +696,7 @@ def share_list_files(token):
|
|||
if not target_parent or not _is_inside_shared_folder(target_parent, shared_folder.id):
|
||||
return jsonify({'error': 'Zugriff verweigert'}), 403
|
||||
|
||||
files = File.query.filter_by(parent_id=parent_id)\
|
||||
files = File.query.filter_by(parent_id=parent_id, is_trashed=False)\
|
||||
.order_by(File.is_folder.desc(), File.name).all()
|
||||
|
||||
# Build breadcrumb from current parent back to shared root
|
||||
|
|
@ -821,15 +821,10 @@ def share_delete_file(token, file_id):
|
|||
if not _is_inside_shared_folder(target_file, link.file_id):
|
||||
return jsonify({'error': 'Datei gehoert nicht zu diesem Ordner'}), 403
|
||||
|
||||
# Delete from disk
|
||||
if target_file.storage_path:
|
||||
filepath = Path(current_app.config['UPLOAD_PATH']) / str(target_file.owner_id) / target_file.storage_path
|
||||
if filepath.exists():
|
||||
filepath.unlink()
|
||||
|
||||
db.session.delete(target_file)
|
||||
# Soft-delete: move to trash
|
||||
_trash_recursive(target_file)
|
||||
db.session.commit()
|
||||
return jsonify({'message': 'Datei geloescht'}), 200
|
||||
return jsonify({'message': 'In Papierkorb verschoben'}), 200
|
||||
|
||||
|
||||
@api_bp.route('/share/<token>/verify', methods=['POST'])
|
||||
|
|
|
|||
Loading…
Reference in New Issue