Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: handle download links #840

Merged
merged 3 commits into from
Oct 24, 2024
Merged

feat: handle download links #840

merged 3 commits into from
Oct 24, 2024

Conversation

ShGKme
Copy link
Contributor

@ShGKme ShGKme commented Oct 23, 2024

☑️ Resolves

Unfortunately, there is no better way to handle download links. Electron doesn't handle it, doesn't trigger will-download nor allows detecting that the link was a download link in will-navigate

🖼️ Screenshots

image

@ShGKme ShGKme added enhancement New feature or request 3. to review labels Oct 23, 2024
@ShGKme ShGKme self-assigned this Oct 23, 2024
Copy link
Contributor

@Antreesy Antreesy left a comment

Choose a reason for hiding this comment

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

Tested

If download attr doesn't specify file extension, it's not considered for file name suggestion:
image

UPD: same for specified .json extension:
image

Something to fix in Talk only?

@ShGKme
Copy link
Contributor Author

ShGKme commented Oct 23, 2024

If download attr doesn't specify file extension, it's not considered for file name suggestion:

Is there an example where we have it?

Poll export is .json

image

And for me it works fine in both cases:

  • download value is without extension
  • file url is without extensions

@ShGKme
Copy link
Contributor Author

ShGKme commented Oct 24, 2024

Checked with @Antreesy.

The problem is that download attribute value is ignored, and neither inline data:* URL, nor URL.createObjectURL allows explicitly setting a filename. As the result, suggested filename is either download.json or UUID from objectURL instead of the download attribute.

@ShGKme ShGKme force-pushed the feat/handle-download-links branch from 8b18958 to eec2347 Compare October 24, 2024 13:26
@ShGKme ShGKme requested a review from Antreesy October 24, 2024 13:26
Copy link
Contributor

@Antreesy Antreesy left a comment

Choose a reason for hiding this comment

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

Remarkable workaround 🙈

Tested. For me the record, file extension should be always provided
image

@ShGKme
Copy link
Contributor Author

ShGKme commented Oct 24, 2024

Tested. For me the record, file extension should be always provided

The filename is defined the same as in a web-browser - via the download attribute. The extension must be provided there.

@ShGKme ShGKme force-pushed the feat/handle-download-links branch from eec2347 to 83342dd Compare October 24, 2024 16:16
@ShGKme ShGKme enabled auto-merge October 24, 2024 16:17
@ShGKme ShGKme merged commit 3744d6d into main Oct 24, 2024
10 checks passed
@ShGKme ShGKme deleted the feat/handle-download-links branch October 24, 2024 16:21
@ShGKme ShGKme mentioned this pull request Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review enhancement New feature or request
Projects
Status: ☑️ Done
Development

Successfully merging this pull request may close these issues.

Feature Request: Direct File Download in Nextcloud Talk on Desktop Bug download file from APP
2 participants