fix(core): Handle missing binary metadata in download urls (#5242)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-01-25 10:19:19 +01:00
committed by GitHub
parent ac460aa841
commit 21579a8a2a
6 changed files with 44 additions and 15 deletions

View File

@@ -202,8 +202,15 @@ export const restApi = Vue.extend({
},
// Binary data
getBinaryUrl: (dataPath, mode): string =>
self.rootStore.getRestApiContext.baseUrl + `/data/${dataPath}?mode=${mode}`,
getBinaryUrl: (dataPath, mode, fileName, mimeType): string => {
let restUrl = self.rootStore.getRestUrl;
if (restUrl.startsWith('/')) restUrl = window.location.origin + restUrl;
const url = new URL(`${restUrl}/data/${dataPath}`);
url.searchParams.append('mode', mode);
if (fileName) url.searchParams.append('fileName', fileName);
if (mimeType) url.searchParams.append('mimeType', mimeType);
return url.toString();
},
// Returns all the available timezones
getExecutionEvents: (id: string): Promise<IAbstractEventMessage[]> => {