# Issue with adding attachments inside table cells

**URL:** https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607
**Category:** Bug
**Created:** [December 10, 2019, 10:49pm UTC](https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607 "2019-12-10T22:49:37Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![terraboss](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/terraboss/32/381157_2.png) [@terraboss](https://meta.discourse.org/u/terraboss)
#### Post date: [December 10, 2019, 10:49pm UTC](https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607/1 "2019-12-10T22:49:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [December 11, 2019, 12:45am UTC](https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607/2 "2019-12-11T00:45:44Z")

</div>

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](https://meta.discourse.org/uploads/short-url/hu8jvVTNiCjzn5XmxXRnhUaRINy.docx) (22.4 KB) |

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

```

---

<div class="post-metadata">

### Author: ![terraboss](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/terraboss/32/381157_2.png) [@terraboss](https://meta.discourse.org/u/terraboss)
#### Post date: [December 11, 2019, 9:34am UTC](https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607/4 "2019-12-11T09:34:51Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [December 11, 2019, 11:22pm UTC](https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607/5 "2019-12-11T23:22:37Z")

</div>

Not following at all what you are proposing here?

---

<div class="post-metadata">

### Author: ![terraboss](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/terraboss/32/381157_2.png) [@terraboss](https://meta.discourse.org/u/terraboss)
#### Post date: [December 11, 2019, 11:45pm UTC](https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607/6 "2019-12-11T23:45:16Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [December 11, 2019, 11:50pm UTC](https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607/7 "2019-12-11T23:50:13Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![terraboss](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/terraboss/32/381157_2.png) [@terraboss](https://meta.discourse.org/u/terraboss)
#### Post date: [December 12, 2019, 12:01am UTC](https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607/8 "2019-12-12T00:01:29Z")

</div>

> [@sam](#):
>
> The old format breaks a large amount of portability issues with uploads.

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?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [December 12, 2019, 1:02am UTC](https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607/9 "2019-12-12T01:02:06Z")

</div>

There is a rake task, it is called:

```plaintext
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:

```plaintext
[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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [December 13, 2019, 3:34am UTC](https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607/10 "2019-12-13T03:34:06Z")

</div>

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

---

<div class="post-metadata">

### Author: ![terraboss](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/terraboss/32/381157_2.png) [@terraboss](https://meta.discourse.org/u/terraboss)
#### Post date: [December 13, 2019, 10:15am UTC](https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607/11 "2019-12-13T10:15:18Z")

</div>

Putting files into order is advanced? 🤔

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.

---

<div class="post-metadata">

### Author: ![wesochuck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wesochuck/32/108706_2.png) [@wesochuck](https://meta.discourse.org/u/wesochuck)
#### Post date: [April 15, 2022, 3:21pm UTC](https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607/12 "2022-04-15T15:21:49Z")

</div>

> [@awesomerobot](#):
>
> Not sure if there’s a fix to be made to avoid it, but if you escape the pipe with `\` it will work.

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.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 26, 2022, 1:51am UTC](https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607/13 "2022-04-26T01:51:26Z")

</div>

> [@wesochuck](#):
>
> 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?

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.
