diff --git a/app/common/src/services/Backend.ts b/app/common/src/services/Backend.ts index ae80d71aa3..b5851d4b98 100644 --- a/app/common/src/services/Backend.ts +++ b/app/common/src/services/Backend.ts @@ -1687,6 +1687,7 @@ export default abstract class Backend { abstract getProjectDetails( projectId: ProjectId, directoryId: DirectoryId | null, + getPresignedUrl?: boolean, ): Promise /** Return Language Server logs for a project session. */ abstract getProjectSessionLogs( @@ -1723,7 +1724,11 @@ export default abstract class Backend { /** Change the name of a file. */ abstract updateFile(fileId: FileId, body: UpdateFileRequestBody, title: string): Promise /** Return file details. */ - abstract getFileDetails(fileId: FileId, title: string): Promise + abstract getFileDetails( + fileId: FileId, + title: string, + getPresignedUrl?: boolean, + ): Promise /** Create a Datalink. */ abstract createDatalink(body: CreateDatalinkRequestBody): Promise /** Return a Datalink. */ diff --git a/app/gui/src/dashboard/components/dashboard/AssetRow.tsx b/app/gui/src/dashboard/components/dashboard/AssetRow.tsx index 1902803465..6ed1f98910 100644 --- a/app/gui/src/dashboard/components/dashboard/AssetRow.tsx +++ b/app/gui/src/dashboard/components/dashboard/AssetRow.tsx @@ -488,7 +488,12 @@ export function RealAssetInternalRow(props: RealAssetRowInternalProps) { case backendModule.AssetType.project: { try { const details = await queryClient.fetchQuery( - backendQueryOptions(backend, 'getProjectDetails', [asset.id, asset.parentId]), + backendQueryOptions( + backend, + 'getProjectDetails', + [asset.id, asset.parentId, true], + { staleTime: 0 }, + ), ) if (details.url != null) { await backend.download(details.url, `${asset.title}.enso-project`) @@ -504,7 +509,9 @@ export function RealAssetInternalRow(props: RealAssetRowInternalProps) { case backendModule.AssetType.file: { try { const details = await queryClient.fetchQuery( - backendQueryOptions(backend, 'getFileDetails', [asset.id, asset.title]), + backendQueryOptions(backend, 'getFileDetails', [asset.id, asset.title, true], { + staleTime: 0, + }), ) if (details.url != null) { await backend.download(details.url, asset.title) diff --git a/app/gui/src/dashboard/services/RemoteBackend.ts b/app/gui/src/dashboard/services/RemoteBackend.ts index e503bc7559..4151d5ce68 100644 --- a/app/gui/src/dashboard/services/RemoteBackend.ts +++ b/app/gui/src/dashboard/services/RemoteBackend.ts @@ -767,8 +767,15 @@ export default class RemoteBackend extends Backend { * Return details for a project. * @throws An error if a non-successful status code (not 200-299) was received. */ - override async getProjectDetails(projectId: backend.ProjectId): Promise { - const path = remoteBackendPaths.getProjectDetailsPath(projectId) + override async getProjectDetails( + projectId: backend.ProjectId, + _directoryId: null, + getPresignedUrl = false, + ): Promise { + const paramsString = new URLSearchParams({ + presigned: `${getPresignedUrl}`, + }).toString() + const path = `${remoteBackendPaths.getProjectDetailsPath(projectId)}?${paramsString}` const response = await this.get(path) if (!responseIsSuccessful(response)) { return await this.throw(response, 'getProjectDetailsBackendError') @@ -959,8 +966,12 @@ export default class RemoteBackend extends Backend { override async getFileDetails( fileId: backend.FileId, title: string, + getPresignedUrl = false, ): Promise { - const path = remoteBackendPaths.getFileDetailsPath(fileId) + const searchParams = new URLSearchParams({ + presigned: `${getPresignedUrl}`, + }).toString() + const path = `${remoteBackendPaths.getFileDetailsPath(fileId)}?${searchParams}` const response = await this.get(path) if (!responseIsSuccessful(response)) { return await this.throw(response, 'getFileDetailsBackendError', title)