Issue with adding attachments inside table cells

Hi there,

it seems, it’s not possible any more, to add attachments inside tables. Any idea how to fix this?

Example

Name File
bla bla
[bla.docx
| Name | File | 
| --- | --- | 
| bla | bla |
| | [bla.docx|attachment](upload://hu8jvVTNiCjzn5XmxXRnhUaRINy.docx) (22.4 KB) | 

It is because of the seperator “|” between file name and the function name attachment.

I really need this, to keep things clean and organised

Not sure if there’s a fix to be made to avoid it, but if you escape the pipe with \ it will work.

Name File
bla bla
bla.docx (22.4 KB)
| Name | File | 
| --- | --- | 
| bla | bla |
| | [bla.docx\|attachment](upload://hu8jvVTNiCjzn5XmxXRnhUaRINy.docx) (22.4 KB) | 
6 Likes

I prefer the old way to add attachments. It would be great if any discourse setting allows me to choose the scheme

Not following at all what you are proposing here?

The syntax scheme has been changed recently. But the old one is still valid. And I‘m suggesting, to give the admin the ability to choose what syntax (old or new) he will provide for the users per default.

I don’t like the pipe workaround. It isn’t self explanatory and is still in conflict with markdown tables over-all.

If you guys thinking, there is no need for such an backwards compability, than, you should think at least about any kind of auto-completion mechanism to catch these kind of behavior inside tables.

Best

It is off the table to offer some sort of setting or plugin that changes it so attachments are specified using HTML vs markdown. You would have to head to marketplace. The old format breaks a large amount of portability issues with uploads.

I am not against fixing this edge case some how, but it is pretty hard to tell if you are in a table or not based off cursor position so fixing this magically is not easy.

4 Likes

For example?

What was the intension to change the format without providing any rake task or something similar? (To update the old code …)

There are several times, the syntax format has changes marginally, with an big effect of the whole content … e.g. with missing spaces between section hastags and their names, or between citations > and text. Especially over multiple levels. It is a mess, to fix these changes manually for hundrets of posts for a single admin. Believe me. I‘d like to be asked, as admin, if I go with you or keep the current syntax format.

In my opinion, it should be no. 1 priority, to make sure every single format change won’t affect the usability of the core functionality.

I‘ve no deeper inside into the curser position issue. I believe you. But it should be possible, because the composer seems to know where a table begins and ends. As long as you are able to determine the courser anywhere between, you could add a pip automatically for uploads. Don’t you?

There is a rake task, it is called:

rake posts:inline_uploads

You would only run this task if you have experienced issues with uploads in the past or were looking to migrate storage from local to s3.

100% or our hosted sites are inline, cause this makes uploads less fragile.

I do feel there is a bit of a storm here over what is essentially an edge case.

Vast majority of posts in the wild contain 0 tables. Of the rare posts actually containing tables the vast majority do not include uploads.

I guess we could support something like this instead of the bar which is resilient to tables:

[bla.docx¦attachment](upload://hu8jvVTNiCjzn5XmxXRnhUaRINy.docx)

I need a bit of time to think about this… not going to rush here to make any changes.

8 Likes

The slash escape is fine. If you’re doing something this advanced, escaping a slash is no big deal.

6 Likes

Putting files into order is advanced? :thinking:

I‘m just wondering, why I can’t change the format to the old style? Most of the previously added attachments are still included this way and everything seems to be working just fine.

Discourse updates are breaking over and over again core functionalities. And there is no further warning about conflicts.

I really like agile development and the docker update manager. But this kind of version management drives me crazy over and over again.

Even the little things matter.

Any chance we could get the upload tool to automatically add in the escape character when it is uploading a file that is going to be used in a table? It took me about 20 minutes to figure out what was causing my table and/or upload to mess everything up on a table article we had.

I think a non-technical user would have just given up.

2 Likes

Very tricky to do this accurately, our markdown engine only does reverse mapping per line, so we would need a bunch of special logic.

If the PR for this is small enough though I would be open to an improvement here.

3 Likes