Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

Update DefaultResourceSchemeHandler.cs #1

Merged
merged 1 commit into from
Oct 29, 2020
Merged

Update DefaultResourceSchemeHandler.cs #1

merged 1 commit into from
Oct 29, 2020

Conversation

xjfnet
Copy link
Contributor

@xjfnet xjfnet commented Oct 28, 2020

ProcessRequestAsync return 404 if the request local file dose not exitst and avoid stuck pending

ProcessRequestAsync return 404 if the request local file dose not exitst and avoid stuck pending
@mattkol mattkol merged commit 2ec8f96 into chromelyapps:master Oct 29, 2020
return CefReturnValue.ContinueAsync;
else
{
StatusCode = (int)HttpStatusCode.NotFound;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest populating the Stream with an error message otherwise you'll end up with a blank page displayed to the user if they request a file that's not found.

You can use ResourceHandler.GetMemoryStream to turn a string into a stream.

https://github.com/cefsharp/CefSharp/blob/c1a4db20fde01a8464130384706993890838084a/CefSharp/ResourceHandler.cs#L333

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good idea.
Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants