🐛Fix downloading by shared link (#118)

This commit is contained in:
Anton Shepilov
2023-06-23 18:26:01 +02:00
committed by GitHub
parent b53427b910
commit 14f772e32e
2 changed files with 4 additions and 8 deletions
@@ -120,17 +120,12 @@ export class DriveApiClient {
}
static async getDownloadUrl(companyId: string, id: string, versionId?: string) {
const { token } = await DriveApiClient.getDownloadToken(companyId, [id], versionId);
if (versionId)
return Api.route(
`/internal/services/documents/v1/companies/${companyId}/item/${id}/download?version_id=${versionId}&token=${token}${appendTdriveToken(
true,
)}`,
`/internal/services/files/v1/companies/${companyId}/files/${id}/download?version_id=${versionId}`,
);
return Api.route(
`/internal/services/documents/v1/companies/${companyId}/item/${id}/download?token=${token}${appendTdriveToken(
true,
)}`,
`/internal/services/files/v1/companies/${companyId}/files/${id}/download`,
);
}
@@ -72,7 +72,7 @@ export const useOnBuildContextMenu = (children: DriveItem[], initialParentId?: s
{
type: 'menu',
text: Languages.t('components.item_context_menu.download'),
onClick: () => download(item.id),
onClick: () => download(item.last_version_cache.file_metadata.external_id),
},
{ type: 'separator' },
{
@@ -444,6 +444,7 @@ export const useOnBuildFileContextMenu = () => {
const { open: preview } = useDrivePreview();
return useCallback(
(item: DriveItem) => {
console.log(item);
const menuItems = [
{
type: 'menu',