remove file:// indirection
This commit is contained in:
parent
9d88147b80
commit
486cd3a6eb
|
|
@ -54,7 +54,7 @@ export const TraceView: React.FC<{
|
||||||
// Test finished.
|
// Test finished.
|
||||||
const attachment = result && result.duration >= 0 && result.attachments.find(a => a.name === 'trace');
|
const attachment = result && result.duration >= 0 && result.attachments.find(a => a.name === 'trace');
|
||||||
if (attachment && attachment.path) {
|
if (attachment && attachment.path) {
|
||||||
loadSingleTraceFile(new URL(attachment.path, 'file://')).then(model => setModel({ model, isLive: false }));
|
loadSingleTraceFile(filePathToTraceURL(attachment.path)).then(model => setModel({ model, isLive: false }));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ export const TraceView: React.FC<{
|
||||||
// Start polling running test.
|
// Start polling running test.
|
||||||
pollTimer.current = setTimeout(async () => {
|
pollTimer.current = setTimeout(async () => {
|
||||||
try {
|
try {
|
||||||
const model = await loadSingleTraceFile(new URL(traceLocation, 'file://'));
|
const model = await loadSingleTraceFile(filePathToTraceURL(traceLocation));
|
||||||
setModel({ model, isLive: true });
|
setModel({ model, isLive: true });
|
||||||
} catch {
|
} catch {
|
||||||
setModel(undefined);
|
setModel(undefined);
|
||||||
|
|
@ -117,15 +117,15 @@ async function loadSingleTraceFile(tracePathOrURL: URL): Promise<MultiTraceModel
|
||||||
return new MultiTraceModel(contextEntries);
|
return new MultiTraceModel(contextEntries);
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatUrl(tracePathOrURL: URL) {
|
function formatUrl(traceURL: URL) {
|
||||||
if (tracePathOrURL.protocol === 'file:') {
|
if (traceURL.hostname === 'dropbox.com')
|
||||||
const url = new URL('/trace/file', location.href);
|
traceURL.hostname = 'dl.dropboxusercontent.com';
|
||||||
url.searchParams.set('path', tracePathOrURL.pathname);
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tracePathOrURL.hostname === 'dropbox.com')
|
return traceURL;
|
||||||
tracePathOrURL.hostname = 'dl.dropboxusercontent.com';
|
}
|
||||||
|
|
||||||
return tracePathOrURL;
|
function filePathToTraceURL(path: string) {
|
||||||
|
const url = new URL('/trace/file', location.href);
|
||||||
|
url.searchParams.set('path', path);
|
||||||
|
return url;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue