Skip to content

Commit

Permalink
Normalize long description line endings when set by API
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Jun 22, 2024
1 parent da090fd commit 63ad6a2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/logic/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from app.logic.LogicError import LogicError
from app.models import User, Package, PackageType, MetaPackage, Tag, ContentWarning, db, Permission, AuditSeverity, \
License, PackageDevState
from app.utils import add_audit_log, has_blocked_domains, diff_dictionaries, describe_difference
from app.utils import add_audit_log, has_blocked_domains, diff_dictionaries, describe_difference, normalize_line_endings
from app.utils.url import clean_youtube_url


Expand Down Expand Up @@ -142,6 +142,9 @@ def do_edit_package(user: User, package: Package, was_new: bool, was_web: bool,
if "media_license" in data:
data["media_license"] = get_license(data["media_license"])

if "desc" in data:
data["desc"] = normalize_line_endings(data["desc"])

if "video_url" in data and data["video_url"] is not None:
data["video_url"] = clean_youtube_url(data["video_url"]) or data["video_url"]
if "dQw4w9WgXcQ" in data["video_url"]:
Expand Down

0 comments on commit 63ad6a2

Please sign in to comment.