Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
e1b69692
Unverified
Commit
e1b69692
authored
4 years ago
by
Julius Härtl
Browse files
Options
Downloads
Patches
Plain Diff
Move NotFoundResponse to a proper TemplateResponse
Signed-off-by:
Julius Härtl
<
jus@bitgrid.net
>
parent
c4a6666e
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
lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php
+8
-9
8 additions, 9 deletions
...e/AppFramework/Middleware/AdditionalScriptsMiddleware.php
lib/public/AppFramework/Http/NotFoundResponse.php
+2
-13
2 additions, 13 deletions
lib/public/AppFramework/Http/NotFoundResponse.php
with
10 additions
and
22 deletions
lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php
+
8
−
9
View file @
e1b69692
...
@@ -53,16 +53,15 @@ class AdditionalScriptsMiddleware extends Middleware {
...
@@ -53,16 +53,15 @@ class AdditionalScriptsMiddleware extends Middleware {
}
}
public
function
afterController
(
$controller
,
$methodName
,
Response
$response
):
Response
{
public
function
afterController
(
$controller
,
$methodName
,
Response
$response
):
Response
{
/*
* There is no need to emit these signals on a public share page
* There is a separate event for that already
*/
if
(
$controller
instanceof
PublicShareController
)
{
return
$response
;
}
if
(
$response
instanceof
TemplateResponse
)
{
if
(
$response
instanceof
TemplateResponse
)
{
$this
->
legacyDispatcher
->
dispatch
(
TemplateResponse
::
EVENT_LOAD_ADDITIONAL_SCRIPTS
,
new
GenericEvent
());
if
(
!
$controller
instanceof
PublicShareController
)
{
/*
* The old event was not dispatched on the public share controller as there was
* OCA\Files_Sharing::loadAdditionalScripts for that. This is kept for compatibility reasons
* only for the old event as this is now also included in BeforeTemplateRenderedEvent
*/
$this
->
legacyDispatcher
->
dispatch
(
TemplateResponse
::
EVENT_LOAD_ADDITIONAL_SCRIPTS
,
new
GenericEvent
());
}
if
(
!
(
$response
instanceof
StandaloneTemplateResponse
)
&&
$this
->
userSession
->
isLoggedIn
())
{
if
(
!
(
$response
instanceof
StandaloneTemplateResponse
)
&&
$this
->
userSession
->
isLoggedIn
())
{
$this
->
legacyDispatcher
->
dispatch
(
TemplateResponse
::
EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN
,
new
GenericEvent
());
$this
->
legacyDispatcher
->
dispatch
(
TemplateResponse
::
EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN
,
new
GenericEvent
());
...
...
This diff is collapsed.
Click to expand it.
lib/public/AppFramework/Http/NotFoundResponse.php
+
2
−
13
View file @
e1b69692
...
@@ -24,30 +24,19 @@
...
@@ -24,30 +24,19 @@
namespace
OCP\AppFramework\Http
;
namespace
OCP\AppFramework\Http
;
use
OCP\Template
;
/**
/**
* A generic 404 response showing an 404 error page as well to the end-user
* A generic 404 response showing an 404 error page as well to the end-user
* @since 8.1.0
* @since 8.1.0
*/
*/
class
NotFoundResponse
extends
Response
{
class
NotFoundResponse
extends
Template
Response
{
/**
/**
* @since 8.1.0
* @since 8.1.0
*/
*/
public
function
__construct
()
{
public
function
__construct
()
{
parent
::
__construct
();
parent
::
__construct
(
'core'
,
'404'
,
[],
'guest'
);
$this
->
setContentSecurityPolicy
(
new
ContentSecurityPolicy
());
$this
->
setContentSecurityPolicy
(
new
ContentSecurityPolicy
());
$this
->
setStatus
(
404
);
$this
->
setStatus
(
404
);
}
}
/**
* @return string
* @since 8.1.0
*/
public
function
render
()
{
$template
=
new
Template
(
'core'
,
'404'
,
'guest'
);
return
$template
->
fetchPage
();
}
}
}
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