Skip to content

Commit 25b888e

Browse files
committed
URLs with GET parameters can be very long
1 parent 4ebd4a0 commit 25b888e

3 files changed

Lines changed: 23 additions & 4 deletions

File tree

testproject/home/tests.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,11 @@ def test_querystrings(self):
295295
# A get with both should also hit, since it is the second request.
296296
self.head_hit(page.get_url() + "?valid=0&utm_code=0")
297297
self.get_hit(page.get_url() + "?valid=0&utm_code=0")
298-
# A get with a very long querysting should return an error
299-
self.head_error(page.get_url() + "?" + "a" * 2000)
300-
self.get_error(page.get_url() + "?" + "a" * 2000)
298+
# A get with a very long querysting should be cached.
299+
self.head_miss(page.get_url() + "?" + "a" * 2000)
300+
self.get_miss(page.get_url() + "?" + "a" * 2000)
301+
self.head_hit(page.get_url() + "?" + "a" * 2000)
302+
self.get_hit(page.get_url() + "?" + "a" * 2000)
301303

302304
@override_settings(WAGTAIL_CACHE_IGNORE_COOKIES=False)
303305
def test_cookie_page(self):
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 4.2.15 on 2024-10-24 00:06
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("wagtailcache", "0002_increase_url_length"),
9+
]
10+
11+
operations = [
12+
migrations.AlterField(
13+
model_name="keyringitem",
14+
name="url",
15+
field=models.TextField(),
16+
),
17+
]

wagtailcache/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class KeyringItem(models.Model):
9090

9191
expiry = models.DateTimeField()
9292
key = models.CharField(max_length=512)
93-
url = models.URLField(max_length=1000)
93+
url = models.TextField()
9494

9595
objects = KeyringItemManager()
9696

0 commit comments

Comments
 (0)