Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions react/ActionsMenu/Actions/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ export const download = ({ encryptedUrl }) => {
icon,
label,
Component: makeComponent(label, icon),
action: (docs, { client, webviewIntent }) =>
downloadFile({ client, file: docs[0], url: encryptedUrl, webviewIntent })
action: (docs, { client, webviewIntent, driveId }) =>
downloadFile({
client,
file: docs[0],
url: encryptedUrl,
webviewIntent,
driveId
})
}
}
2 changes: 1 addition & 1 deletion react/FileImageLoader/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class FileImageLoader extends Component {
throw new Error('No pdf files fallback')
}
const src = await client
.collection('io.cozy.files')
.collection('io.cozy.files', { driveId: file.driveId })
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the file is an io.cozy.files object, where the driveId comes from ? It is not documented https://docs.cozy.io/cozy-doctypes/io.cozy.files.html 🤔 And I don't remember we have such attr on it.

Copy link
Member

@zatteo zatteo Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, did you test this to check if it works @lethemanh ? If I remember well, shared drive id comes from io.cozy.sharing and not io.cozy.files. Same for cozy/cozy-libs#2805 ?

About documentation, shared drives are still a work in progress on back side, so doctype documentation can be incomplete. But it will need to be completed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the request with driveId will send to this API sharings/drives/:driveId/downloads?Id=...&Filename=... and it's not working at this moment. This is the error

{
    "errors": [
        {
            "status": "422",
            "title": "Invalid Attribute",
            "detail": "Invalid document type",
            "source": {
                "pointer": "/data/attributes/type"
            }
        }
    ]
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that we have driveId on files https://github.com/cozy/cozy-stack/pull/4511/files & cozy/cozy-client#1604

So yeah doctype documentation needs to be updated once the stack PR is merged.

and yes sharings/drives/:driveId/downloads? seems to not have been implemented yet https://github.com/cozy/cozy-stack/pull/4511/files#diff-4ade94bc84a0d258576e850dcc6d9a18a5be2781ddb37103a3b2e910a550cf6fR322

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you are right. @taratatach is it possible implement this route also to download versions of a file ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This route has been implemented in cozy/cozy-stack@4e4c45e. Do you need something else?

.getDownloadLinkById(this.getFileId(file), file.name)
await checkImageSource(src)
if (this._mounted) {
Expand Down
Loading