-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In Auto setup, when IsUninitialized, response http status code 503 #16834
base: main
Are you sure you want to change the base?
Conversation
src/OrchardCore.Modules/OrchardCore.AutoSetup/Services/IAutoSetupService.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.AutoSetup/Services/AutoSetupService.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.AutoSetup/Services/AutoSetupService.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.AutoSetup/Services/AutoSetupService.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.AutoSetup/Services/AutoSetupService.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.AutoSetup/Services/AutoSetupService.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.AutoSetup/Services/AutoSetupService.cs
Outdated
Show resolved
Hide resolved
…tupService.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…upService.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…upService.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…upService.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…upService.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…upService.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
A unit of functional test will be a plus |
src/OrchardCore.Modules/OrchardCore.AutoSetup/AutoSetupMiddleware.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.AutoSetup/Services/IAutoSetupService.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.AutoSetup/Services/AutoSetupService.cs
Outdated
Show resolved
Hide resolved
…tupService.cs Co-authored-by: Zoltán Lehóczky <[email protected]>
…upService.cs Co-authored-by: Zoltán Lehóczky <[email protected]>
How do you test this? |
} | ||
} | ||
} | ||
|
||
httpContext.Response.Redirect(pathBase); | ||
|
||
return; | ||
} | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would prevent the error message from being displayed to the user. Like server-side validation or database creation error.
Even if you still decide to keep 503 as the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sebastienros : Just committed
Won't stop other Middlewares after success
So @infofromca, how do you test this? |
@infofromca When you're done addressing all feedback of a review, click "Re-request review" in the top-right corner for each reviewer when you're ready for another round of review, so they know that you're done. Also, I'm still waiting for your reply on how one can test this. |
@Piedone for your reply on how one can test this, please see the unit test |
I'm talking about trying it out manually. How can I try this out and make sure that it works? How did you do this during development? |
I think a new read.me will be required. Let me find the time for it, will have vacation in near future |
@Piedone : I just tested it manually. there was a DI error which I just corrected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/OrchardCore.Modules/OrchardCore.AutoSetup/Services/AutoSetupService.cs
Outdated
Show resolved
Hide resolved
|
||
await httpContext.Response.WriteAsync($"The AutoSetup failed installing the site '{_setupOptions.SiteName}' with errors: {stringBuilder}."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't write error messages to the response directly. For instance here the SiteName is user input and could contain XSS. I believe it was only logged before. If we want to keep doing it then we don't need the tuple as a return type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sebastienros : Committed new one of shouldn't write error messages to the response directly
test/OrchardCore.Tests/Modules/OrchardCore.AutoSetup/AutoSetupMiddlewareTests.cs
Outdated
Show resolved
Hide resolved
test/OrchardCore.Tests/Modules/OrchardCore.AutoSetup/AutoSetupMiddlewareTests.cs
Outdated
Show resolved
Hide resolved
test/OrchardCore.Tests/Modules/OrchardCore.AutoSetup/AutoSetupMiddlewareTests.cs
Outdated
Show resolved
Hide resolved
|
||
var httpContext = new DefaultHttpContext(); | ||
|
||
var middleware = new AutoSetupMiddleware( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can create a private
method for middleware creation to make reusable across the unit tests
src/OrchardCore.Modules/OrchardCore.AutoSetup/Services/AutoSetupService.cs
Outdated
Show resolved
Hide resolved
…MiddlewareTests.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…MiddlewareTests.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…MiddlewareTests.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…upService.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
Fixes #16833