Skip to content

Commit 60ef276

Browse files
authored
fix: Fixed the issue where auto download is disabled in certain browsers (#72)
# Description Fixed the issue where auto download is disabled in certain browsers. It is now unable in browsers like Safari and DuckDuckGo. Fixes #71 ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ## Checklist - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] Any dependent changes have been merged and published in downstream modules
2 parents 07d4e02 + e1d7a88 commit 60ef276

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [3.1.17] - 2025-03-11
6+
7+
### Fixed
8+
9+
- Fixed the issue where auto download is disabled in certain browsers
10+
511
## [3.1.16] - 2025-02-14
612

713
### Changed

client/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "client",
3-
"version": "3.1.16",
3+
"version": "3.1.17",
44
"private": true,
55
"type": "module",
66
"scripts": {

client/src/components/ReceiveItem.vue

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,30 @@ function onTextClick(): void {
3535
3636
const supportsHover = window.matchMedia('(hover: hover)').matches
3737
38-
const downloadLink = ref(null)
38+
const downloadLink = ref<HTMLAnchorElement | null>(null)
39+
40+
// Auto download may be restricted in some environments, such as iOS and DuckDuckGo desktop.
41+
const isRestrictedEnv = () => {
42+
const ua = navigator.userAgent
43+
return (
44+
/(iPhone|iPod|iPad).*AppleWebKit/i.test(ua) ||
45+
/DuckDuckGo\/\d+\.\d+/.test(ua)
46+
)
47+
}
3948
4049
watch(
4150
() => props.success,
4251
success => {
43-
if (success && autoDownload.value && props.type === 'TRANSFER_TYPE_FILE') {
52+
if (
53+
success &&
54+
autoDownload.value &&
55+
props.type === 'TRANSFER_TYPE_FILE' &&
56+
!isRestrictedEnv()
57+
) {
4458
setTimeout(() => {
45-
downloadLink.value.click()
59+
if (downloadLink.value) {
60+
downloadLink.value.click()
61+
}
4662
}, 1000)
4763
}
4864
},

0 commit comments

Comments
 (0)