Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACAS-761: Fix download urls for experiment files containing # special character #1146

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading