chore: update returned attachement fullPath (#9516)

### Solution

fullPath prop on attachement (when returned by backend) is updated to
'domain + path' (formerly 'path').

Consequently, getFileAbsoluteURI util in front is removed.

closes #8763

---------

Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
This commit is contained in:
Etienne
2025-01-09 19:12:36 +01:00
committed by GitHub
parent 4c8c338316
commit 1f1cac3b00
8 changed files with 11 additions and 32 deletions

View File

@ -17,12 +17,10 @@ window.URL.revokeObjectURL = jest.fn();
describe.skip('downloadFile', () => {
it('should download a file', () => {
// Call downloadFile
downloadFile('path/to/file.pdf', 'file.pdf');
downloadFile('url/to/file.pdf', 'file.pdf');
// Assert on fetch
expect(fetch).toHaveBeenCalledWith(
process.env.REACT_APP_SERVER_BASE_URL + '/files/path/to/file.pdf',
);
expect(fetch).toHaveBeenCalledWith('url/to/file.pdf');
// Assert on element creation
const link = document.querySelector(

View File

@ -1,8 +1,7 @@
import { saveAs } from 'file-saver';
import { getFileAbsoluteURI } from '~/utils/file/getFileAbsoluteURI';
export const downloadFile = (fullPath: string, fileName: string) => {
fetch(getFileAbsoluteURI(fullPath))
fetch(fullPath)
.then((resp) =>
resp.status === 200
? resp.blob()