Skip to content

Commit 6bba8e4

Browse files
author
Mark Williams
committed
LIMS_1970: Fix Logs & Files view if filepath is null
1 parent 3ade510 commit 6bba8e4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

client/src/js/modules/dc/views/autoprocattachments.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ define(['marionette',
1919
},
2020

2121
render: function() {
22-
var filePath = this.model.get('FILEPATH')
22+
var filePath = this.model.get('FILEPATH') || ''
2323
var displayedPath = filePath.split('/').length > 4 ? filePath.split('/').slice(0, 4).join('/') + '/...' : filePath
2424

2525
this.$el.html(`
@@ -34,19 +34,19 @@ define(['marionette',
3434

3535
copyPathToClipboard: function(e) {
3636
e.preventDefault()
37-
var fullPath = this.model.get('FILEPATH')
37+
var filePath = this.model.get('FILEPATH') || ''
3838
if (navigator.clipboard && navigator.clipboard.writeText) {
39-
navigator.clipboard.writeText(fullPath).then(() => {
39+
navigator.clipboard.writeText(filePath).then(() => {
4040
var $icon = $(e.currentTarget).find('i')
4141
$icon.removeClass('fa-clipboard').addClass('fa-check')
4242
setTimeout(() => {
4343
$icon.removeClass('fa-check').addClass('fa-clipboard')
4444
}, 2000)
4545
}).catch(err => {
46-
alert('Failed to copy path. Please try again or copy manually: ' + fullPath)
46+
alert('Failed to copy path. Please try again or copy manually: ' + filePath)
4747
})
4848
} else {
49-
alert('Full path: ' + fullPath)
49+
alert('Full path: ' + filePath)
5050
}
5151
}
5252
})
@@ -65,9 +65,10 @@ define(['marionette',
6565
var iCatBaseUrl = this.column.escape('iCatUrl');
6666
var isIndustry = this.column.escape('isIndustryProposal').toLowerCase() === 'true';
6767
var isPurgedSession = this.column.escape('isPurgedSession').toLowerCase() === 'true';
68+
var filePath = this.model.get('FILEPATH') || '';
6869

6970
// Files with "visit_persist_storage_dir_segment" (config.php) in their path are assumed to exist permanently and ignore the BLSESSION purged value
70-
var isPersistentFile = persistentStorageSegment ? this.model.get('FILEPATH').includes(persistentStorageSegment) : false;
71+
var isPersistentFile = persistentStorageSegment ? filePath.includes(persistentStorageSegment) : false;
7172

7273
if (isPersistentFile == true | isPurgedSession == false) {
7374

0 commit comments

Comments
 (0)