Skip to content

Commit a8dc0a8

Browse files
Merge pull request #437 from bcgov/ofmcc-6773-fix-document-link
fix: remove PDF in new tab feature
2 parents 63d7ae9 + 9cee254 commit a8dc0a8

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

frontend/src/components/messages/RequestConversations.vue

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<span class="font-weight-bold">Sent:</span>
6868
{{ format.formatDate(item.sentDate) }}
6969
</div>
70-
<div class="pt-1" @click.capture="handlePdf" v-html="item.message" />
70+
<div class="pt-1" v-html="item.message" />
7171
</v-col>
7272
</v-row>
7373
</template>
@@ -209,16 +209,6 @@ export default {
209209
deriveFromDisplay(item) {
210210
return item.ofmSourceSystem ? `${this.userInfo?.firstName ?? ''} ${this.userInfo?.lastName}` : OFM_PROGRAM
211211
},
212-
handlePdf(event) {
213-
if (event.target.classList.contains('conversation-pdf')) {
214-
fetch(event.target.dataset.link)
215-
.then((res) => res.blob())
216-
.then((blob) => {
217-
const blobUrl = URL.createObjectURL(blob)
218-
window.open(blobUrl)
219-
})
220-
}
221-
},
222212
async formatConversation() {
223213
const parser = new DOMParser()
224214
for (const conversation of this.assistanceRequestConversation) {
@@ -246,14 +236,8 @@ export default {
246236
const file = await FileService.getFile(fileId)
247237
const dataLink = `data:${file.mimetype};base64,${file.fileData}`
248238
249-
if (file.mimetype === 'application/pdf') {
250-
fileLink.setAttribute('href', '#')
251-
fileLink.classList.add('conversation-pdf')
252-
fileLink.setAttribute('data-link', dataLink)
253-
} else {
254-
fileLink.setAttribute('href', dataLink)
255-
fileLink.setAttribute('download', file.filename)
256-
}
239+
fileLink.setAttribute('href', dataLink)
240+
fileLink.setAttribute('download', file.filename)
257241
} else {
258242
fileLink.remove()
259243
}

0 commit comments

Comments
 (0)