From 0dac8be8898f5e54fa3e0537d5ac3beae7ad74d5 Mon Sep 17 00:00:00 2001 From: Krishna Kaushal Date: Sat, 30 Nov 2024 07:57:36 +0530 Subject: [PATCH 01/12] Truncation added for String length --- blt/middleware/ip_restrict.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/blt/middleware/ip_restrict.py b/blt/middleware/ip_restrict.py index 783f6a31a..218b0765d 100644 --- a/blt/middleware/ip_restrict.py +++ b/blt/middleware/ip_restrict.py @@ -149,7 +149,8 @@ def __call__(self, request): if new_count > MAX_COUNT: new_count = MAX_COUNT - ip_record.agent = agent + # Truncate agent to 255 characters if it exceeds the limit + ip_record.agent = agent[:255] ip_record.count = new_count if ip_record.pk: ip_record.save(update_fields=["agent", "count"]) From e3238515bc7bf71cc2266d92f3412a76e328b0d2 Mon Sep 17 00:00:00 2001 From: Krishna Kaushal Date: Sat, 30 Nov 2024 08:12:54 +0530 Subject: [PATCH 02/12] Truncation added for String length --- blt/middleware/ip_restrict.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blt/middleware/ip_restrict.py b/blt/middleware/ip_restrict.py index 218b0765d..652c68a79 100644 --- a/blt/middleware/ip_restrict.py +++ b/blt/middleware/ip_restrict.py @@ -149,7 +149,7 @@ def __call__(self, request): if new_count > MAX_COUNT: new_count = MAX_COUNT - # Truncate agent to 255 characters if it exceeds the limit + # Truncate agent to 255 characters if it exceeds the limit before updating the record ip_record.agent = agent[:255] ip_record.count = new_count if ip_record.pk: From ac8277b4667fff646e894a260906d44aa2798cd9 Mon Sep 17 00:00:00 2001 From: Krishna Kaushal Date: Mon, 2 Dec 2024 05:17:32 +0530 Subject: [PATCH 03/12] Changed CharField to Textfield in models.py --- blt/middleware/ip_restrict.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blt/middleware/ip_restrict.py b/blt/middleware/ip_restrict.py index 652c68a79..aaeda2c68 100644 --- a/blt/middleware/ip_restrict.py +++ b/blt/middleware/ip_restrict.py @@ -149,8 +149,8 @@ def __call__(self, request): if new_count > MAX_COUNT: new_count = MAX_COUNT - # Truncate agent to 255 characters if it exceeds the limit before updating the record - ip_record.agent = agent[:255] + # Truncate agent to 500 characters if it exceeds the limit before updating the record + ip_record.agent = agent[:500] ip_record.count = new_count if ip_record.pk: ip_record.save(update_fields=["agent", "count"]) From 57e5551b964bd8029b60977b383a59d0f4191218 Mon Sep 17 00:00:00 2001 From: Krishna Kaushal Date: Mon, 2 Dec 2024 05:18:54 +0530 Subject: [PATCH 04/12] Changed CharField to Textfield in models.py --- website/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/models.py b/website/models.py index 113bb9fe2..4e881c052 100644 --- a/website/models.py +++ b/website/models.py @@ -731,7 +731,7 @@ class IP(models.Model): user = models.CharField(max_length=150, null=True, blank=True) issuenumber = models.IntegerField(null=True, blank=True) created = models.DateTimeField(auto_now_add=True) - agent = models.CharField(max_length=255, null=True, blank=True) + agent = models.TextField(null=True, blank=True) count = models.BigIntegerField(default=1) path = models.CharField(max_length=255, null=True, blank=True) method = models.CharField(max_length=10, null=True, blank=True) From 240dea78f628e75f20dba29795739225af86a7d1 Mon Sep 17 00:00:00 2001 From: Krishna Kaushal Date: Mon, 2 Dec 2024 15:37:51 +0530 Subject: [PATCH 05/12] removed Truncation --- blt/middleware/ip_restrict.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/blt/middleware/ip_restrict.py b/blt/middleware/ip_restrict.py index aaeda2c68..783f6a31a 100644 --- a/blt/middleware/ip_restrict.py +++ b/blt/middleware/ip_restrict.py @@ -149,8 +149,7 @@ def __call__(self, request): if new_count > MAX_COUNT: new_count = MAX_COUNT - # Truncate agent to 500 characters if it exceeds the limit before updating the record - ip_record.agent = agent[:500] + ip_record.agent = agent ip_record.count = new_count if ip_record.pk: ip_record.save(update_fields=["agent", "count"]) From 9ee0e2fd716c72eddbd012fdfa61fea7f7fb1c80 Mon Sep 17 00:00:00 2001 From: Krishna Kaushal Date: Tue, 3 Dec 2024 05:44:24 +0530 Subject: [PATCH 06/12] Added migrations file --- .../0161_alter_badge_icon_alter_ip_agent.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 website/migrations/0161_alter_badge_icon_alter_ip_agent.py diff --git a/website/migrations/0161_alter_badge_icon_alter_ip_agent.py b/website/migrations/0161_alter_badge_icon_alter_ip_agent.py new file mode 100644 index 000000000..751358d3f --- /dev/null +++ b/website/migrations/0161_alter_badge_icon_alter_ip_agent.py @@ -0,0 +1,22 @@ +# Generated by Django 5.1.3 on 2024-12-03 00:11 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("website", "0160_merge_20241129_0712"), + ] + + operations = [ + migrations.AlterField( + model_name="badge", + name="icon", + field=models.ImageField(blank=True, null=True, upload_to="badges/"), + ), + migrations.AlterField( + model_name="ip", + name="agent", + field=models.TextField(blank=True, null=True), + ), + ] From 6f3e16a01f99aa1ceb9718f635581293164bad7a Mon Sep 17 00:00:00 2001 From: Krishna Kaushal Date: Tue, 3 Dec 2024 22:46:59 +0530 Subject: [PATCH 07/12] Fixing failed tests --- website/migrations/0161_alter_badge_icon_alter_ip_agent.py | 1 - 1 file changed, 1 deletion(-) diff --git a/website/migrations/0161_alter_badge_icon_alter_ip_agent.py b/website/migrations/0161_alter_badge_icon_alter_ip_agent.py index 751358d3f..67f03e99f 100644 --- a/website/migrations/0161_alter_badge_icon_alter_ip_agent.py +++ b/website/migrations/0161_alter_badge_icon_alter_ip_agent.py @@ -1,5 +1,4 @@ # Generated by Django 5.1.3 on 2024-12-03 00:11 - from django.db import migrations, models From 1ea8df41921985c8d843e9e3f9570a085a49fbec Mon Sep 17 00:00:00 2001 From: Krishna Kaushal Date: Wed, 4 Dec 2024 01:54:37 +0530 Subject: [PATCH 08/12] Fixed truncation failing tests --- website/migrations/0161_alter_badge_icon_alter_ip_agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/migrations/0161_alter_badge_icon_alter_ip_agent.py b/website/migrations/0161_alter_badge_icon_alter_ip_agent.py index 67f03e99f..87f6b3773 100644 --- a/website/migrations/0161_alter_badge_icon_alter_ip_agent.py +++ b/website/migrations/0161_alter_badge_icon_alter_ip_agent.py @@ -4,7 +4,7 @@ class Migration(migrations.Migration): dependencies = [ - ("website", "0160_merge_20241129_0712"), + ("website", "0161_alter_badge_icon"), ] operations = [ From a9e854737382d0f939294f6ddbb83491fc11a0d3 Mon Sep 17 00:00:00 2001 From: Krishna Kaushal Date: Wed, 4 Dec 2024 02:11:03 +0530 Subject: [PATCH 09/12] Fixing Failing tests --- website/migrations/0165_merge_20241203_2036.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 website/migrations/0165_merge_20241203_2036.py diff --git a/website/migrations/0165_merge_20241203_2036.py b/website/migrations/0165_merge_20241203_2036.py new file mode 100644 index 000000000..0048760c0 --- /dev/null +++ b/website/migrations/0165_merge_20241203_2036.py @@ -0,0 +1,12 @@ +# Generated by Django 5.1.3 on 2024-12-03 20:36 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("website", "0161_alter_badge_icon_alter_ip_agent"), + ("website", "0164_integration_company_integrations_slackintegration"), + ] + + operations = [] From 920717aac2fcc6fdfecd6af6223f63c3adbd1988 Mon Sep 17 00:00:00 2001 From: Krishna Kaushal Date: Mon, 23 Dec 2024 02:01:13 +0530 Subject: [PATCH 10/12] renamed migration file --- ..._alter_ip_agent.py => 0175_alter_badge_icon_alter_ip_agent.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename website/migrations/{0161_alter_badge_icon_alter_ip_agent.py => 0175_alter_badge_icon_alter_ip_agent.py} (100%) diff --git a/website/migrations/0161_alter_badge_icon_alter_ip_agent.py b/website/migrations/0175_alter_badge_icon_alter_ip_agent.py similarity index 100% rename from website/migrations/0161_alter_badge_icon_alter_ip_agent.py rename to website/migrations/0175_alter_badge_icon_alter_ip_agent.py From 08a7d2c0e1cf0affa25b78944cbf7f2cc5c7d4dc Mon Sep 17 00:00:00 2001 From: Krishna Kaushal Date: Mon, 23 Dec 2024 02:08:30 +0530 Subject: [PATCH 11/12] latest commit --- website/migrations/0165_merge_20241203_2036.py | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 website/migrations/0165_merge_20241203_2036.py diff --git a/website/migrations/0165_merge_20241203_2036.py b/website/migrations/0165_merge_20241203_2036.py deleted file mode 100644 index 0048760c0..000000000 --- a/website/migrations/0165_merge_20241203_2036.py +++ /dev/null @@ -1,12 +0,0 @@ -# Generated by Django 5.1.3 on 2024-12-03 20:36 - -from django.db import migrations - - -class Migration(migrations.Migration): - dependencies = [ - ("website", "0161_alter_badge_icon_alter_ip_agent"), - ("website", "0164_integration_company_integrations_slackintegration"), - ] - - operations = [] From 999fa9f43d98fcb7ad219bcd05b96436e607d1fb Mon Sep 17 00:00:00 2001 From: Krishna Kaushal Date: Sat, 28 Dec 2024 19:51:16 +0530 Subject: [PATCH 12/12] pre-commit fix --- ...lter_ip_agent.py => 0177_alter_badge_icon_alter_ip_agent.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename website/migrations/{0175_alter_badge_icon_alter_ip_agent.py => 0177_alter_badge_icon_alter_ip_agent.py} (86%) diff --git a/website/migrations/0175_alter_badge_icon_alter_ip_agent.py b/website/migrations/0177_alter_badge_icon_alter_ip_agent.py similarity index 86% rename from website/migrations/0175_alter_badge_icon_alter_ip_agent.py rename to website/migrations/0177_alter_badge_icon_alter_ip_agent.py index 87f6b3773..3ebbd1efb 100644 --- a/website/migrations/0175_alter_badge_icon_alter_ip_agent.py +++ b/website/migrations/0177_alter_badge_icon_alter_ip_agent.py @@ -4,7 +4,7 @@ class Migration(migrations.Migration): dependencies = [ - ("website", "0161_alter_badge_icon"), + ("website", "0176_repo_contributor_repo_contributor_count_and_more"), ] operations = [