Skip to content

Commit 6122b9b

Browse files
Issue 53408: Encode field names in attachment download links (#6827)
1 parent be8ecbb commit 6122b9b

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

experiment/src/org/labkey/experiment/api/ExpDataClassDataTableImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ private void configureAttachmentURL(MutableColumnInfo col)
537537
{
538538
ActionURL url = new ActionURL(ExperimentController.DataClassAttachmentDownloadAction.class, getUserSchema().getContainer())
539539
.addParameter("lsid", "${LSID}")
540-
.addParameter("name", "${" + col.getName() + "}");
540+
.addParameter("name", "${" + PageFlowUtil.encode(col.getName()) + "}");
541541
if (FileLinkDisplayColumn.AS_ATTACHMENT_FORMAT.equalsIgnoreCase(col.getFormat()))
542542
{
543543
url.addParameter("inline", "false");
@@ -622,7 +622,7 @@ public void decorateColumn(MutableColumnInfo columnInfo, PropertyDescriptor pd)
622622
columnInfo.setURL(StringExpressionFactory.createURL(
623623
new ActionURL(ExperimentController.DataClassAttachmentDownloadAction.class, getContainer())
624624
.addParameter("lsid", "${LSID}")
625-
.addParameter("name", "${" + columnInfo.getFieldKey() + "}")));
625+
.addParameter("name", "${" + PageFlowUtil.encode(columnInfo.getName()) + "}")));
626626

627627
}
628628

list/src/org/labkey/list/model/ListTable.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
import org.labkey.api.security.permissions.UpdatePermission;
7171
import org.labkey.api.study.assay.FileLinkDisplayColumn;
7272
import org.labkey.api.util.ContainerContext;
73+
import org.labkey.api.util.PageFlowUtil;
7374
import org.labkey.api.util.StringExpressionFactory;
7475
import org.labkey.api.view.ActionURL;
7576
import org.labkey.data.xml.TableType;
@@ -366,7 +367,7 @@ public void overlayMetadata(Collection<TableType> metadata, UserSchema schema, C
366367

367368
private void configureAttachmentURL(MutableColumnInfo col)
368369
{
369-
ActionURL url = ListController.getDownloadURL(_list, "${EntityId}", "${" + col.getName() + "}");
370+
ActionURL url = ListController.getDownloadURL(_list, "${EntityId}", "${" + PageFlowUtil.encode(col.getName()) + "}");
370371
if (FileLinkDisplayColumn.AS_ATTACHMENT_FORMAT.equalsIgnoreCase(col.getFormat()))
371372
{
372373
url.addParameter("inline", "false");

0 commit comments

Comments
 (0)