question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FileConsentCard's Descripton property has no way to escape the ampersand character.

See original GitHub issue

Github issues should be used for bugs and feature requests. Use Stack Overflow for general “how-to” questions.

Version

4.15.0

Describe the bug

On a FileConsentCard, it does not appear to be possible to use an unescaped ampersand in the Description property. The same issue seems to be present on the Attachment name.

To Reproduce

The following code is used to generate a FileConsentCard for the user to either accept or decline a file. The file name contains an ampersand which is not formatted correctly.

var consentContext = new Dictionary<string, string>
{
	{ "blobId", blob.BlobId },
	{ "filename", blob.FileName },
	{ "messageString", blob.Message }
};

var fileCard = new FileConsentCard
{
	Description = "P&LTest.xlsx",
	SizeInBytes = blob.FileLength,
	AcceptContext = consentContext,
	DeclineContext = consentContext
};

var asAttachment = new Attachment
{
	Content = fileCard,
	ContentType = FileConsentCard.ContentType,
	Name = "P&LTest.xlsx",
};

replyActivity.Attachments.Add(asAttachment);

await turnContext.SendActivitiesAsync(activities.ToArray(), cancellationToken);

The above produces the following file consent card.

image

Clicking the allow button successfully distributes the file, but the name is changed so it cannot be opened in the default app, Excel in this case.

I have tried to escape the ampersand with & and with %26 without success.

Expected behavior

File should appear with the ampersand in place as it was set on the Description for FileConsentCard and the Name for an Attachment.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:19 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
Meghana-MSFTcommented, Dec 15, 2021

We are able to repro this issue, we are raising a bug for the same. We will update you.

0reactions
hopsusacommented, Dec 7, 2022

@Meghana-MSFT - it looks like the file is displaying properly when it is delivered…

image

…but the preview seems to fail…

image

If I download the file, it removes the ampersand and any text after in the name. However, if I rename the file locally and add the extension, I am able to open it successfully.

Thanks,

Matt

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I escape ampersands in XML so they are rendered ...
The & character is itself an escape character in XML so the solution is to concatenate it and a Unicode decimal equivalent for...
Read more >
Getting literal ampersands from summary field in a view of fields
I have a view where we are using the Body Summary field. I got a bug report that an HTML entity, & ,...
Read more >
How do I escape an ampersand in the Read XML activity?
The unescaped ampersand in the text means that it does not represent a legal XML document and the parser is correct to reject...
Read more >
how to escape the character '&' - Microsoft Q&A
We are getting the following error when the escape character '&' used in the XQuery. Query: SELECT t.RECID FROM FBNK_CAMB044 t WHERE ...
Read more >
HTML: No, you don't need to escape that - mina86.com
First of all, an ampersand which is not followed by an alphanumeric character or a hash does not need to be escape.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found