Skip to content

Commit dab893d

Browse files
Fix invalid chapter page
1 parent 221f73a commit dab893d

File tree

7 files changed

+19
-10
lines changed

7 files changed

+19
-10
lines changed

MangAdventure/storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ def _photon_url(self, name: str) -> str:
4949
domain = settings.CONFIG['DOMAIN']
5050
scheme = settings.ACCOUNT_DEFAULT_HTTP_PROTOCOL
5151
base = f'{scheme}://i3.wp.com/'
52-
qs = {'ssl': 1} if scheme == 'https' else dict()
52+
qs = {'ssl': '1'} if scheme == 'https' else dict()
5353
if name.lower().endswith(('.jpg', '.jpeg')):
54-
qs['quality'] = 100
54+
qs['quality'] = '100'
5555
if self._fit:
5656
qs['fit'] = f'{self._fit["w"]},{self._fit["h"]}'
5757
return base + domain + self.base_url + name + '?' + urlencode(qs)

MangAdventure/templates/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
{% block stylesheets %}
6060
{% cache 604800 styles %}
6161
<link href="{% static 'COMPILED/styles/style.css' %}"
62-
rel="preload stylesheet" as="style" type="text/css">
62+
rel="stylesheet preload" as="style" type="text/css">
6363
<link href="{% static 'COMPILED/extra/style.css' %}" rel="stylesheet" type="text/css">
6464
<noscript>
6565
<link href="{% static 'styles/noscript.css' %}" rel="stylesheet" type="text/css">
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
<?xml version="1.0" encoding="UTF-8"?>{% load cache custom_tags %}
2-
<OpenSearchDescription{% cache 2628000 opensearch %}
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- {% load cache custom_tags %} -->
3+
<!-- {% cache 2628000 opensearch %} -->
4+
<OpenSearchDescription
35
xmlns="http://a9.com/-/spec/opensearch/1.1/"
46
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
57
<ShortName>{{ name }}</ShortName>
@@ -10,4 +12,5 @@
1012
<Developer>https://github.com/mangadventure</Developer>
1113
<moz:SearchForm>{{ search }}</moz:SearchForm>
1214
<moz:UpdateUrl>{{ self }}</moz:UpdateUrl>
13-
</OpenSearchDescription>{% endcache %}
15+
</OpenSearchDescription>
16+
<!-- {% endcache %} -->

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ v0.8.4
55
^^^^^^
66

77
* Fixed licensed chapter page
8+
* Fixed invalid chapter page
89

910
v0.8.3
1011
^^^^^^

reader/views.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,15 @@ def chapter_page(request: HttpRequest, slug: str, vol: int,
200200
).reverse())
201201
if not chapters:
202202
raise Http404('No chapters for this series')
203-
max_ = len(chapters) - 1
203+
max_, found = len(chapters) - 1, False
204204
for idx, current in enumerate(chapters):
205205
if current == (vol, num):
206206
next_ = chapters[idx - 1] if idx > 0 else None
207207
prev_ = chapters[idx + 1] if idx < max_ else None
208+
found = True
208209
break
210+
if not found:
211+
raise Http404('No such chapter')
209212
if page == 1:
210213
Chapter.track_view(id=current.id)
211214
all_pages = list(current.pages.all())

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
django~=3.2.12
22
djangorestframework>=3.13
3-
django-allauth>=0.47
3+
django-allauth>=0.49
44
Pillow>=9.0
55
libsass>=0.21
66
yaenv~=1.3.2; python_version=='3.7'

users/tests/test_receivers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from allauth.account.adapter import DefaultAccountAdapter
12
from allauth.account.models import EmailAddress, EmailConfirmation
23
from pytest import fixture
34

@@ -6,15 +7,16 @@
67

78
@fixture
89
def mock_allauth_adapter(monkeypatch):
9-
class MockAdapter:
10+
class MockAdapter(DefaultAccountAdapter):
1011
def confirm_email(self, *args):
1112
pass
1213

1314
def send_confirmation_mail(self, *args):
1415
pass
1516

1617
monkeypatch.setattr(
17-
'allauth.account.models.get_adapter', lambda _: MockAdapter()
18+
'allauth.account.models.get_adapter',
19+
lambda *_: MockAdapter()
1820
)
1921

2022

0 commit comments

Comments
 (0)