Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shlee
funkwhale
Commits
cf555b8a
Verified
Commit
cf555b8a
authored
5 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Patches
Plain Diff
Fixed broken HTML manifest regex
parent
ebf774d5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/funkwhale_api/common/middleware.py
+1
-1
1 addition, 1 deletion
api/funkwhale_api/common/middleware.py
api/tests/common/test_middleware.py
+6
-2
6 additions, 2 deletions
api/tests/common/test_middleware.py
with
7 additions
and
3 deletions
api/funkwhale_api/common/middleware.py
+
1
−
1
View file @
cf555b8a
...
@@ -77,7 +77,7 @@ def serve_spa(request):
...
@@ -77,7 +77,7 @@ def serve_spa(request):
return
http
.
HttpResponse
(
head
+
tail
)
return
http
.
HttpResponse
(
head
+
tail
)
MANIFEST_LINK_REGEX
=
re
.
compile
(
r
"
<link
.
*rel=(?:
'
|\")?manifest(?:
'
|\")?
.
*>
"
)
MANIFEST_LINK_REGEX
=
re
.
compile
(
r
"
<link
[^>]
*rel=(?:
'
|\")?manifest(?:
'
|\")?
[^>]
*>
"
)
def
replace_manifest_url
(
head
,
new_url
):
def
replace_manifest_url
(
head
,
new_url
):
...
...
This diff is collapsed.
Click to expand it.
api/tests/common/test_middleware.py
+
6
−
2
View file @
cf555b8a
...
@@ -274,7 +274,9 @@ def test_throttle_status_middleware_returns_proper_response(mocker):
...
@@ -274,7 +274,9 @@ def test_throttle_status_middleware_returns_proper_response(mocker):
def
test_rewrite_manifest_json_url
(
link
,
new_url
,
expected
,
mocker
,
settings
):
def
test_rewrite_manifest_json_url
(
link
,
new_url
,
expected
,
mocker
,
settings
):
settings
.
FUNKWHALE_SPA_REWRITE_MANIFEST
=
True
settings
.
FUNKWHALE_SPA_REWRITE_MANIFEST
=
True
settings
.
FUNKWHALE_SPA_REWRITE_MANIFEST_URL
=
new_url
settings
.
FUNKWHALE_SPA_REWRITE_MANIFEST_URL
=
new_url
spa_html
=
"
<html><head>{}</head></html>
"
.
format
(
link
)
spa_html
=
"
<html><head><link rel=before>{}<link rel=after></head></html>
"
.
format
(
link
)
request
=
mocker
.
Mock
(
path
=
"
/
"
)
request
=
mocker
.
Mock
(
path
=
"
/
"
)
mocker
.
patch
.
object
(
middleware
,
"
get_spa_html
"
,
return_value
=
spa_html
)
mocker
.
patch
.
object
(
middleware
,
"
get_spa_html
"
,
return_value
=
spa_html
)
mocker
.
patch
.
object
(
mocker
.
patch
.
object
(
...
@@ -283,7 +285,9 @@ def test_rewrite_manifest_json_url(link, new_url, expected, mocker, settings):
...
@@ -283,7 +285,9 @@ def test_rewrite_manifest_json_url(link, new_url, expected, mocker, settings):
response
=
middleware
.
serve_spa
(
request
)
response
=
middleware
.
serve_spa
(
request
)
assert
response
.
status_code
==
200
assert
response
.
status_code
==
200
expected_html
=
"
<html><head>{}
\n\n
</head></html>
"
.
format
(
expected
)
expected_html
=
"
<html><head><link rel=before>{}<link rel=after>
\n\n
</head></html>
"
.
format
(
expected
)
assert
response
.
content
==
expected_html
.
encode
()
assert
response
.
content
==
expected_html
.
encode
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment