Merge "Fix 'data:,'-uri attachement treatment"
diff --git a/Changes b/Changes
index a0c1aca..f619bb0 100755
--- a/Changes
+++ b/Changes
@@ -1,9 +1,10 @@
-0.32 2019-01-29
+0.32 2019-02-08
         - Support attachements in metadata fields (#77).
         - Added ping request option to Piwik.
         - Fix handling of login errors.
         - Added Statistics reload option (hebasta, #66).
-        - Fixed VC query serialization.
+        - Fixed VC query serialization (hebasta).
+        - Fix treatment of 'data:,'-attachements.
 
 0.31 2018-11-30
         - Update to Mojolicious >= 8.06.
diff --git a/dev/js/spec/matchSpec.js b/dev/js/spec/matchSpec.js
index 04e188e..9b3ef9e 100644
--- a/dev/js/spec/matchSpec.js
+++ b/dev/js/spec/matchSpec.js
@@ -86,7 +86,12 @@
       "type": "type:attachement",
       "value": "data:application/x.korap-link;title=Cool,https://de.wikipedia.org/wiki/Beispiel"
     },
-
+    {
+      "@type": "koral:field",
+      "key": "z-reference",
+      "type": "type:attachement",
+      "value": "data:,This is a reference"
+    }
   ];
 
 
@@ -752,14 +757,20 @@
 	  }); 
 
     it('attachements should be formatted', function(){
-		  //type:attachement
+		  //type:attachement with a link
       expect(mel.children[3].children[1].getAttribute('data-type')).toEqual('type:attachement')
 		  expect(mel.children[3].children[1].classList.contains('metakeyvalues')).toBeFalsy;
 		  expect(mel.children[3].children[0].firstChild.nodeValue).toEqual('xlink');
 		  expect(mel.children[3].children[1].firstChild.textContent).toEqual('Cool');
 		  expect(mel.children[3].children[1].firstChild.tagName).toEqual('A');
       expect(mel.children[3].children[1].firstChild.getAttribute('href')).toEqual('https://de.wikipedia.org/wiki/Beispiel');
-	  }); 
+
+		  //type:attachement with plain text
+      expect(mel.children[4].children[1].getAttribute('data-type')).toEqual('type:attachement')
+		  expect(mel.children[4].children[1].classList.contains('metakeyvalues')).toBeFalsy;
+      expect(mel.children[4].children[0].firstChild.nodeValue).toEqual('z-reference');
+      expect(mel.children[4].children[1].firstChild.nodeValue).toEqual('This is a reference');
+    }); 
  
     
   
diff --git a/dev/js/src/match/attachement.js b/dev/js/src/match/attachement.js
index 4548703..7b6cb94 100644
--- a/dev/js/src/match/attachement.js
+++ b/dev/js/src/match/attachement.js
@@ -10,7 +10,7 @@
  * @author Nils Diewald
  */
 define(function () {
-  const uriRE = new RegExp("^data: *([^;,]+?(?: *; *[^,;]+?)*) *, *(.+)$");
+  const uriRE = new RegExp("^data: *([^;,]*?(?: *; *[^,;]+?)*) *, *(.+)$");
   const mapRE = new RegExp("^ *([^=]+?) *= *(.+?) *$");
 
   return {