[BUG] Custom URI are deleted on subsequent edit
Asked by Hexabit GmbH:

**Problem Description**

We have a custom URL protocol (hxcrypt://) which launches an application on our side. First it works, but on a subsequent edit of this page, the \<a ... /\> tag is still there, but the href attribute is missing.

Do we need to register the URL somewhere in the system?

**Failed Workarounds**

* Not setting a link name
* Link inside or outside of a table
* Escaping the hash in the url

**Steps to Reproduce**

Create a Web Link on a page with the following parameters:

URL: hxcrypt://eyJTYWx0IjoiM0V5dC9hc2IyWENVVzFIOEFSRTVueDdiTjdDeEEwT254YUE5ZFhjWFlMa1FPTkVLVlVwYWdscXFDcDBEWHV2dE41dERNM01OU1NLRkhkYUFMbjVicFE9PSIsIkNyeXB0b0hhc2giOiJxTUk2Z1g3NnAvZ1NUUjdqUUlZam13PT0ifQ==

Name: Test

Save the page. Then edit the page, change something in the document, then save again. The web link is now broken.

**Version Information**

|------------------------|-------|
| **Confluence-Version** | 6.0.4 |
| **Build-Nummer**       | 7102  |

|---------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Betriebssystem**              | Linux 3.16.0-4-amd64                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| **Betriebssystemarchitektur**   | amd64                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| **Anwendungsserver**            | Apache Tomcat/8.0.39                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| **Servlet-Version**             | 3.1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| **Java-Version**                | 1.8.0_112                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| **Java-Hersteller**             | Oracle Corporation                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **JVM-Version**                 | 1.8                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| **JVM-Hersteller**              | Oracle Corporation                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **JVM-Implementierungsversion** | 25.112-b15                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| **Java Runtime**                | Java(TM) SE Runtime Environment                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| **Java VM**                     | Java HotSpot(TM) 64-Bit Server VM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **Java-Laufzeitargumente**      | -Djava.util.logging.config.file=/home/atlassian/confluence/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.tomcat.websocket.DEFAULT_BUFFER_SIZE=32768 -Xms1024m -Xmx1024m -XX:+UseG1GC -Datlassian.plugins.enable.wait=300 -Djava.awt.headless=true -XX:G1ReservePercent=20 -Xloggc:/home/atlassian/confluence/logs/gc-2017-11-09_18-53-39.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M -XX:-PrintGCDetails -XX:+PrintGCDateStamps -XX:-PrintTenuringDistribution -Djava.endorsed.dirs=/home/atlassian/confluence/endorsed -Dcatalina.base=/home/atlassian/confluence -Dcatalina.home=/home/atlassian/confluence -Djava.io.tmpdir=/home/atlassian/confluence/temp |

|---------------------------------------------------|---------------------------------------------|
| **Datenbankname**                                 | PostgreSQL                                  |
| **Datenbankversion**                              | 9.4.10                                      |
| **Datenbankdialekt**                              | net.sf.hibernate.dialect.PostgreSQLDialect  |
| **Name des Datenbanktreibers**                    | org.postgresql.Driver                       |
| **Version des Datenbanktreibers**                 | PostgreSQL 9.4.1212                         |
| **URL f?r Datenbankverbindung**                   | jdbc:postgresql://localhost:5432/confluence |
| **Transaktionsisolation f?r Datenbankverbindung** | Read committed                              |
| **Datenbank-Wartezeit**                           | 0                                           |

<br />

Thank you in advance!

luetm


Answers:
author: Nic Brough -Adaptavist-
body: Are your users using plain text or the link option? How have you customised the link option to understand the new non-standard protocol?


author: Hexabit GmbH
body: We use the 'Link' button in the toolbar. I did not have to customize anything on the JIRA/Confluence side. The protocol is registered in the Windows Registry and works with a custom application we developed.

comments: author: Nic Brough -Adaptavist-
body: Ok. Confluence does not recognise that as a valid link, so it does not save it as a link. That's why I asked what you had customised, because you need to hack the code in confluence to tell it that this should be treated as a link.


author: Hexabit GmbH
body: That's not entirely true. The first time around, it works and it recognizes the link as valid. When I save, everything works, the click launchers our software, everthing perfect. But, when I go on to edit the page again at some later time, the link will be gone.

Is it possible to tell confluence, that the hxcrypt:// protocol is valid?


author: Nic Brough -Adaptavist-
body: You would have to hack the code.

The reason that it seems valid at first until edited is probably that the "create link" code has been written to accept anything without validation because users may post invalid stuff. Editing is expected to put valid things in.


author: Hexabit GmbH
body: OK. I'll look if I can find a plugin that lets me put plain HTML in there, then it should work.