Skip to content

Commit

Permalink
URLs with GET parameters can be very long
Browse files Browse the repository at this point in the history
  • Loading branch information
aweakley committed Oct 25, 2024
1 parent 58f3f74 commit 2386b30
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
8 changes: 5 additions & 3 deletions testproject/home/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,11 @@ def test_querystrings(self):
# A get with both should also hit, since it is the second request.
self.head_hit(page.get_url() + "?valid=0&utm_code=0")
self.get_hit(page.get_url() + "?valid=0&utm_code=0")
# A get with a very long querysting should return an error
self.head_error(page.get_url() + "?" + "a" * 2000)
self.get_error(page.get_url() + "?" + "a" * 2000)
# A get with a very long querysting should be cached.
self.head_miss(page.get_url() + "?" + "a" * 2000)
self.get_miss(page.get_url() + "?" + "a" * 2000)
self.head_hit(page.get_url() + "?" + "a" * 2000)
self.get_hit(page.get_url() + "?" + "a" * 2000)

@override_settings(WAGTAIL_CACHE_IGNORE_COOKIES=False)
def test_cookie_page(self):
Expand Down
17 changes: 17 additions & 0 deletions wagtailcache/migrations/0003_alter_keyringitem_url.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.15 on 2024-10-24 00:06

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("wagtailcache", "0002_increase_url_length"),
]

operations = [
migrations.AlterField(
model_name="keyringitem",
name="url",
field=models.TextField(),
),
]
2 changes: 1 addition & 1 deletion wagtailcache/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class KeyringItem(models.Model):

expiry = models.DateTimeField()
key = models.CharField(max_length=512)
url = models.URLField(max_length=1000)
url = models.TextField()

objects = KeyringItemManager()

Expand Down

0 comments on commit 2386b30

Please sign in to comment.