Skip to content

Commit 81826fe

Browse files
committed
done
1 parent fde719f commit 81826fe

4 files changed

+79
-6
lines changed

website/management/commands/fetch_gsoc_orgs.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ def assign_contacts(self, org, social_links):
118118
"facebook": "facebook",
119119
}
120120

121+
def sanitize_url(self, url):
122+
"""Sanitizes URLs to ensure they are safe."""
123+
return re.sub(r"[^a-zA-Z0-9:/._-]", "", url)
124+
121125
for link in social_links:
122126
name = link.get("name", "").lower()
123127
value = link.get("value", "")
@@ -128,9 +132,9 @@ def assign_contacts(self, org, social_links):
128132
else:
129133
setattr(org, social_mapping[name], value)
130134
elif "element.io" in value:
131-
org.element_url = value
135+
org.element_url = self.sanitize_url(value)
132136
elif "gitter.im" in value:
133-
org.gitter_url = value
137+
org.gitter_url = self.sanitize_url(value)
134138
elif "discord" in value:
135-
org.discord_url = value
136-
org.save()
139+
org.discord_url = self.sanitize_url(value)
140+
org.save()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Generated by Django 5.1.6 on 2025-03-02 20:08
2+
3+
import django.db.models.deletion
4+
from django.conf import settings
5+
from django.db import migrations, models
6+
7+
import website.models
8+
9+
10+
class Migration(migrations.Migration):
11+
dependencies = [
12+
("website", "0215_bid_github_username_alter_bid_user"),
13+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14+
]
15+
16+
operations = [
17+
migrations.AddField(
18+
model_name="githubissue",
19+
name="bch_tx_id",
20+
field=models.CharField(blank=True, max_length=255, null=True),
21+
),
22+
migrations.AddField(
23+
model_name="githubissue",
24+
name="p2p_amount_bch",
25+
field=models.DecimalField(blank=True, decimal_places=8, max_digits=18, null=True),
26+
),
27+
migrations.AddField(
28+
model_name="githubissue",
29+
name="p2p_amount_usd",
30+
field=models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True),
31+
),
32+
migrations.AddField(
33+
model_name="githubissue",
34+
name="p2p_payment_created_at",
35+
field=models.DateTimeField(blank=True, null=True),
36+
),
37+
migrations.AddField(
38+
model_name="githubissue",
39+
name="sent_by_user",
40+
field=models.ForeignKey(
41+
blank=True,
42+
null=True,
43+
on_delete=django.db.models.deletion.SET_NULL,
44+
related_name="github_issue_p2p_payments",
45+
to=settings.AUTH_USER_MODEL,
46+
),
47+
),
48+
migrations.AlterField(
49+
model_name="bid",
50+
name="bch_address",
51+
field=models.CharField(
52+
blank=True, max_length=100, null=True, validators=[website.models.validate_bch_address]
53+
),
54+
),
55+
migrations.AlterField(
56+
model_name="userprofile",
57+
name="bch_address",
58+
field=models.CharField(
59+
blank=True, max_length=100, null=True, validators=[website.models.validate_bch_address]
60+
),
61+
),
62+
migrations.AlterField(
63+
model_name="userprofile",
64+
name="btc_address",
65+
field=models.CharField(
66+
blank=True, max_length=100, null=True, validators=[website.models.validate_btc_address]
67+
),
68+
),
69+
]

website/migrations/0216_auto_20250302_2018.py website/migrations/0217_auto_20250302_2018.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class Migration(migrations.Migration):
55
dependencies = [
6-
("website", "0215_bid_github_username_alter_bid_user"),
6+
("website", "0216_githubissue_bch_tx_id_githubissue_p2p_amount_bch_and_more"),
77
]
88

99
operations = [

website/migrations/0217_organization_discord_url_organization_element_url_and_more.py website/migrations/0218_organization_discord_url_organization_element_url_and_more.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
class Migration(migrations.Migration):
77
dependencies = [
8-
("website", "0216_auto_20250302_2018"),
8+
("website", "0217_auto_20250302_2018"),
99
]
1010

1111
operations = [

0 commit comments

Comments
 (0)