use existing helper

This commit is contained in:
Simon Knott 2024-11-04 16:34:40 +01:00
parent dd9184701e
commit cb06aee1fa
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -26,7 +26,7 @@ import type { StackFrame } from '@protocol/channels';
import { CopyToClipboard } from './copyToClipboard';
import { ToolbarButton } from '@web/components/toolbarButton';
import { Toolbar } from '@web/components/toolbar';
import { testServerBaseURL } from '../settings';
import { filePathToTraceURL } from './uiModeTraceView';
export const SourceTab: React.FunctionComponent<{
stack?: StackFrame[],
@ -74,7 +74,7 @@ export const SourceTab: React.FunctionComponent<{
try {
let response = await fetch(`sha1/src@${sha1}.txt`);
if (response.status === 404)
response = await fetch(new URL(`/trace/file?path=${encodeURIComponent(file)}`, testServerBaseURL));
response = await fetch(filePathToTraceURL(file));
if (response.status >= 400)
source.content = `<Unable to read "${file}">`;
else