Skip to content

Commit

Permalink
Merge pull request #1146 from mcneilco/ACAS-761
Browse files Browse the repository at this point in the history
ACAS-761: Fix download urls for experiment files containing # special character
  • Loading branch information
bffrost authored Mar 28, 2024
2 parents 289fd5d + 626a5a7 commit 05d2ca1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions modules/Components/src/client/ACASFormFields.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -872,9 +872,9 @@ class ACASFormLSFileValueFieldController extends ACASFormAbstractFieldController
if !displayText?
displayText = fileValue
if @displayInline
@$('.bv_file').html '<img src="'+encodeURI(window.conf.datafiles.downloadurl.prefix+fileValue)+'" alt="'+ displayText+'">'
@$('.bv_file').html '<img src="'+window.conf.datafiles.downloadurl.prefix+encodeURIComponent(fileValue)+'" alt="'+ displayText+'">'
else
@$('.bv_file').html '<a href="'+encodeURI(window.conf.datafiles.downloadurl.prefix+fileValue)+'">'+displayText+'</a>'
@$('.bv_file').html '<a href="'+window.conf.datafiles.downloadurl.prefix+encodeURIComponent(fileValue)+'">'+displayText+'</a>'
@$('.bv_deleteSavedFile').show()

createNewFileChooser: ->
Expand Down
6 changes: 3 additions & 3 deletions modules/ServerAPI/src/client/AttachFile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ class BasicFileController extends AbstractFormController
$(@el).empty()
$(@el).html @template(@model.attributes)
fileValue = @model.escape('fileValue')
urlValue = @model.excape('urlValue')
urlValue = @model.escape('urlValue')
if ((fileValue is null or fileValue is "" or fileValue is undefined) and (urlValue is null or urlValue is "" or urlValue is undefined))
@createNewFileChooser()
else
if urlValue?
@$('.bv_uploadFile').html '<div style="margin-top:5px;margin-left:4px;"> <a href="'+ encodeURI(urlValue)+'">'+urlValue+'</a></div>'
else
@$('.bv_uploadFile').html '<div style="margin-top:5px;margin-left:4px;"> <a href="'+encodeURI(window.conf.datafiles.downloadurl.prefix+fileValue)+'">'+@model.escape('comments')+'</a></div>'
@$('.bv_uploadFile').html '<div style="margin-top:5px;margin-left:4px;"> <a href="'+window.conf.datafiles.downloadurl.prefix+encodeURIComponent(fileValue)+'">'+@model.escape('comments')+'</a></div>'
@$('.bv_recordedBy').html @model.escape("recordedBy")
@$('.bv_recordedDate').html UtilityFunctions::convertMSToYMDDate @model.get("recordedDate")
@
Expand Down Expand Up @@ -249,7 +249,7 @@ class AttachFileController extends BasicFileController
if fileValue is null or fileValue is "" or fileValue is undefined
@createNewFileChooser()
else
@$('.bv_uploadFile').html '<div style="margin-top:5px;margin-left:4px;"> <a href="'+encodeURI(window.conf.datafiles.downloadurl.prefix+fileValue)+'" target="_blank">'+@model.get('comments')+'</a></div>'
@$('.bv_uploadFile').html '<div style="margin-top:5px;margin-left:4px;"> <a href="'+window.conf.datafiles.downloadurl.prefix+encodeURIComponent(fileValue)+'" target="_blank">'+@model.get('comments')+'</a></div>'

uneditableFileTypes = window.conf.experiment.uneditableFileTypes
unless uneditableFileTypes?
Expand Down

0 comments on commit 05d2ca1

Please sign in to comment.