mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 12:08:01 +00:00
fix: CORS issue with file download (#10755)
# Pull Request Template ## Description https://github.com/chatwoot/utils/pull/38 ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useAlert } from 'dashboard/composables';
|
||||||
import BaseBubble from './Base.vue';
|
import BaseBubble from './Base.vue';
|
||||||
import Button from 'next/button/Button.vue';
|
import Button from 'next/button/Button.vue';
|
||||||
import Icon from 'next/icon/Icon.vue';
|
import Icon from 'next/icon/Icon.vue';
|
||||||
@@ -10,6 +12,8 @@ import { downloadFile } from '@chatwoot/utils';
|
|||||||
import GalleryView from 'dashboard/components/widgets/conversation/components/GalleryView.vue';
|
import GalleryView from 'dashboard/components/widgets/conversation/components/GalleryView.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['error']);
|
const emit = defineEmits(['error']);
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
const { filteredCurrentChatAttachments, attachments } = useMessageContext();
|
const { filteredCurrentChatAttachments, attachments } = useMessageContext();
|
||||||
|
|
||||||
const attachment = computed(() => {
|
const attachment = computed(() => {
|
||||||
@@ -31,7 +35,7 @@ const downloadAttachment = async () => {
|
|||||||
isDownloading.value = true;
|
isDownloading.value = true;
|
||||||
await downloadFile({ url: dataUrl, type: fileType, extension });
|
await downloadFile({ url: dataUrl, type: fileType, extension });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// error
|
useAlert(t('GALLERY_VIEW.ERROR_DOWNLOADING'));
|
||||||
} finally {
|
} finally {
|
||||||
isDownloading.value = false;
|
isDownloading.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import { ref, computed, onMounted } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useAlert } from 'dashboard/composables';
|
||||||
|
|
||||||
import { useStoreGetters } from 'dashboard/composables/store';
|
import { useStoreGetters } from 'dashboard/composables/store';
|
||||||
import { useKeyboardEvents } from 'dashboard/composables/useKeyboardEvents';
|
import { useKeyboardEvents } from 'dashboard/composables/useKeyboardEvents';
|
||||||
import { messageTimestamp } from 'shared/helpers/timeHelper';
|
import { messageTimestamp } from 'shared/helpers/timeHelper';
|
||||||
@@ -22,6 +25,8 @@ const props = defineProps({
|
|||||||
const emit = defineEmits(['close']);
|
const emit = defineEmits(['close']);
|
||||||
const show = defineModel('show', { type: Boolean, default: false });
|
const show = defineModel('show', { type: Boolean, default: false });
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
const getters = useStoreGetters();
|
const getters = useStoreGetters();
|
||||||
|
|
||||||
const ALLOWED_FILE_TYPES = {
|
const ALLOWED_FILE_TYPES = {
|
||||||
@@ -129,7 +134,7 @@ const onClickDownload = async () => {
|
|||||||
isDownloading.value = true;
|
isDownloading.value = true;
|
||||||
await downloadFile({ url, type, extension });
|
await downloadFile({ url, type, extension });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// error
|
useAlert(t('GALLERY_VIEW.ERROR_DOWNLOADING'));
|
||||||
} finally {
|
} finally {
|
||||||
isDownloading.value = false;
|
isDownloading.value = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -356,5 +356,8 @@
|
|||||||
},
|
},
|
||||||
"COPILOT": {
|
"COPILOT": {
|
||||||
"TRY_THESE_PROMPTS": "Try these prompts"
|
"TRY_THESE_PROMPTS": "Try these prompts"
|
||||||
|
},
|
||||||
|
"GALLERY_VIEW": {
|
||||||
|
"ERROR_DOWNLOADING": "Unable to download attachment. Please try again"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
"@breezystack/lamejs": "^1.2.7",
|
"@breezystack/lamejs": "^1.2.7",
|
||||||
"@chatwoot/ninja-keys": "1.2.3",
|
"@chatwoot/ninja-keys": "1.2.3",
|
||||||
"@chatwoot/prosemirror-schema": "1.1.1-next",
|
"@chatwoot/prosemirror-schema": "1.1.1-next",
|
||||||
"@chatwoot/utils": "^0.0.31",
|
"@chatwoot/utils": "^0.0.32",
|
||||||
"@formkit/core": "^1.6.7",
|
"@formkit/core": "^1.6.7",
|
||||||
"@formkit/vue": "^1.6.7",
|
"@formkit/vue": "^1.6.7",
|
||||||
"@hcaptcha/vue3-hcaptcha": "^1.3.0",
|
"@hcaptcha/vue3-hcaptcha": "^1.3.0",
|
||||||
|
|||||||
10
pnpm-lock.yaml
generated
10
pnpm-lock.yaml
generated
@@ -23,8 +23,8 @@ importers:
|
|||||||
specifier: 1.1.1-next
|
specifier: 1.1.1-next
|
||||||
version: 1.1.1-next
|
version: 1.1.1-next
|
||||||
'@chatwoot/utils':
|
'@chatwoot/utils':
|
||||||
specifier: ^0.0.31
|
specifier: ^0.0.32
|
||||||
version: 0.0.31
|
version: 0.0.32
|
||||||
'@formkit/core':
|
'@formkit/core':
|
||||||
specifier: ^1.6.7
|
specifier: ^1.6.7
|
||||||
version: 1.6.7
|
version: 1.6.7
|
||||||
@@ -404,8 +404,8 @@ packages:
|
|||||||
'@chatwoot/prosemirror-schema@1.1.1-next':
|
'@chatwoot/prosemirror-schema@1.1.1-next':
|
||||||
resolution: {integrity: sha512-/M2qZ+ZF7GlQNt1riwVP499fvp3hxSqd5iy8hxyF9pkj9qQ+OKYn5JK+v3qwwqQY3IxhmNOn1Lp6tm7vstrd9Q==}
|
resolution: {integrity: sha512-/M2qZ+ZF7GlQNt1riwVP499fvp3hxSqd5iy8hxyF9pkj9qQ+OKYn5JK+v3qwwqQY3IxhmNOn1Lp6tm7vstrd9Q==}
|
||||||
|
|
||||||
'@chatwoot/utils@0.0.31':
|
'@chatwoot/utils@0.0.32':
|
||||||
resolution: {integrity: sha512-15ir4Jf6q4/gIFC6KqgWZu/NEWYnaw5j2/JB+CYGzZ5a/e+rXG7nmY/sObvRqCnMW6LCS2++shlVQdTxle3CyQ==}
|
resolution: {integrity: sha512-q+1m0/yvbuIheSJv8g1teK5L4XWwNtcXSWQv9jJw0svbp7bvmTycmNZfrcXbARl3EdBPORuVNJU2mVr+0CyrGQ==}
|
||||||
engines: {node: '>=10'}
|
engines: {node: '>=10'}
|
||||||
|
|
||||||
'@codemirror/commands@6.7.0':
|
'@codemirror/commands@6.7.0':
|
||||||
@@ -5154,7 +5154,7 @@ snapshots:
|
|||||||
prosemirror-utils: 1.2.2(prosemirror-model@1.22.3)(prosemirror-state@1.4.3)
|
prosemirror-utils: 1.2.2(prosemirror-model@1.22.3)(prosemirror-state@1.4.3)
|
||||||
prosemirror-view: 1.34.1
|
prosemirror-view: 1.34.1
|
||||||
|
|
||||||
'@chatwoot/utils@0.0.31':
|
'@chatwoot/utils@0.0.32':
|
||||||
dependencies:
|
dependencies:
|
||||||
date-fns: 2.29.3
|
date-fns: 2.29.3
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user