mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-11 12:33:45 +03:00
fix: provisional fix for Trace Viewer source 404 (#29192)
Motivation: Sometimes the files are not available anymore on the Service Worker side. The Trace Viewer frontend then falls back to `file?path=` and uses its response, no matter what the response status is. This patch checks for the response status code before using its response. e.g. https://github.com/microsoft/playwright-dotnet/issues/2775 after some time / and some other reports. --------- Signed-off-by: Max Schmitt <max@schmitt.mx> Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
This commit is contained in:
parent
5ee7179b13
commit
36ebdfb441
@ -67,6 +67,9 @@ export const SourceTab: React.FunctionComponent<{
|
||||
let response = await fetch(`sha1/src@${sha1}.txt`);
|
||||
if (response.status === 404)
|
||||
response = await fetch(`file?path=${encodeURIComponent(file)}`);
|
||||
if (response.status >= 400)
|
||||
source.content = `<Unable to read "${file}">`;
|
||||
else
|
||||
source.content = await response.text();
|
||||
} catch {
|
||||
source.content = `<Unable to read "${file}">`;
|
||||
|
Loading…
Reference in New Issue
Block a user