Second revision
This commit is contained in:
@@ -142,7 +142,7 @@ def create_url(current_user, project_id):
|
||||
|
||||
# --- Prepare URL Document (using original data for optional fields) ---
|
||||
# Optional fields are taken directly from original data, not schema output here
|
||||
keywords_data = data.get("keywords", []) # Process keywords manually as before
|
||||
keywords_data = json_data.get("keywords", []) # Process keywords manually as before
|
||||
keywords_converted = []
|
||||
if isinstance(keywords_data, list):
|
||||
for kw in keywords_data:
|
||||
@@ -153,20 +153,21 @@ def create_url(current_user, project_id):
|
||||
percentage = float(kw.get("percentage", 0.0))
|
||||
keywords_converted.append({"word": word, "percentage": percentage})
|
||||
except (ValueError, TypeError):
|
||||
logger.warning(f"Could not convert keyword percentage for word '{word}' during URL creation.")
|
||||
logger.warning(
|
||||
f"Could not convert keyword percentage for word '{word}' during URL creation.")
|
||||
else:
|
||||
logger.warning("Non-dict item found in keywords during URL creation.")
|
||||
|
||||
now = datetime.datetime.now(datetime.timezone.utc)
|
||||
url_doc = {
|
||||
"projectId": project_obj_id,
|
||||
"url": user_url, # Use validated URL
|
||||
"title": data.get("title", "").strip(),
|
||||
"favicon": data.get("favicon", ""),
|
||||
"starred": bool(data.get("starred", False)),
|
||||
"note": data.get("note", "").strip(),
|
||||
"url": user_url, # Use validated URL
|
||||
"title": json_data.get("title", "").strip(), # FIX: Changed from data to json_data
|
||||
"favicon": json_data.get("favicon", ""), # FIX: Changed from data to json_data
|
||||
"starred": bool(json_data.get("starred", False)), # FIX: Changed from data to json_data
|
||||
"note": json_data.get("note", "").strip(), # FIX: Changed from data to json_data
|
||||
"keywords": keywords_converted,
|
||||
"summary": data.get("summary", "").strip(),
|
||||
"summary": json_data.get("summary", "").strip(), # FIX: Changed from data to json_data
|
||||
"processingStatus": "pending",
|
||||
"createdAt": now,
|
||||
"updatedAt": now
|
||||
|
||||
Reference in New Issue
Block a user