This commit is contained in:
nose
2025-12-11 23:21:45 -08:00
parent 16d8a763cd
commit e2ffcab030
44 changed files with 3558 additions and 1793 deletions

View File

@@ -222,7 +222,7 @@ def create_app():
"path": str(file_path),
"size": file_path.stat().st_size,
"metadata": metadata,
"tags": tags
"tag": tags
}), 200
except Exception as e:
logger.error(f"Get metadata error: {e}", exc_info=True)
@@ -238,7 +238,7 @@ def create_app():
data = request.get_json() or {}
file_path_str = data.get('path')
tags = data.get('tags', [])
tags = data.get('tag', [])
url = data.get('url', [])
if not file_path_str:
@@ -289,7 +289,7 @@ def create_app():
return jsonify({"error": "File not found"}), 404
tags = db.get_tags(file_path)
return jsonify({"hash": file_hash, "tags": tags}), 200
return jsonify({"hash": file_hash, "tag": tags}), 200
except Exception as e:
logger.error(f"Get tags error: {e}", exc_info=True)
return jsonify({"error": f"Failed: {str(e)}"}), 500
@@ -302,11 +302,11 @@ def create_app():
from API.folder import API_folder_store
data = request.get_json() or {}
tags = data.get('tags', [])
tags = data.get('tag', [])
mode = data.get('mode', 'add')
if not tags:
return jsonify({"error": "Tags required"}), 400
return jsonify({"error": "Tag required"}), 400
try:
with API_folder_store(STORAGE_PATH) as db:
@@ -318,7 +318,7 @@ def create_app():
db.remove_tags(file_path, db.get_tags(file_path))
db.add_tags(file_path, tags)
return jsonify({"hash": file_hash, "tags_added": len(tags), "mode": mode}), 200
return jsonify({"hash": file_hash, "tag_added": len(tags), "mode": mode}), 200
except Exception as e:
logger.error(f"Add tags error: {e}", exc_info=True)
return jsonify({"error": f"Failed: {str(e)}"}), 500
@@ -330,7 +330,7 @@ def create_app():
"""Remove tags from a file."""
from API.folder import API_folder_store
tags_str = request.args.get('tags', '')
tags_str = request.args.get('tag', '')
try:
with API_folder_store(STORAGE_PATH) as db: