From 4e2c354e9664cd251129105441904b421b824059 Mon Sep 17 00:00:00 2001 From: Sergey Malinin Date: Wed, 26 Oct 2016 00:02:30 +1000 Subject: [PATCH] Fix POSH sniffer --- src/lib/posh.js | 4 ++-- src/panel.js | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/lib/posh.js b/src/lib/posh.js index 840ee35..3c96e7e 100644 --- a/src/lib/posh.js +++ b/src/lib/posh.js @@ -295,7 +295,7 @@ var POSH = (function () { var href = el.getAttribute("href"); if (rel && href) { - href = fix_href(href); + href = encodeURI(fix_href(href)); var title = el.getAttribute("title"); var type = el.getAttribute("type"); addTriple("#this", encodeURI(rel), href); @@ -306,7 +306,7 @@ var POSH = (function () { addTriple(href+"#this", "schema:fileFormat", type); } else if(rev && href) { - href = fix_href(href); + href = encodeURI(fix_href(href)); addTriple(href, encodeURI(rev), "<#this>") } } diff --git a/src/panel.js b/src/panel.js index ef07072..9606777 100644 --- a/src/panel.js +++ b/src/panel.js @@ -556,12 +556,15 @@ function check_POSH(dData) var handler = new Handle_Turtle(); handler.parse([dData.posh.text], dData.docURL, function(error, html_data) { + gData.posh.ttl_text = dData.posh.text; if (error) - dData.posh.error = error; - else { + dData.posh.error.push(error); + + if (html_data) dData.posh.expanded = html_data; - gData.posh.ttl_text = dData.posh.text; - } + + if (handler.skipped_error.length>0) + dData.posh.error = dData.posh.error.concat(handler.skipped_error); check_RDFa(dData); }); @@ -615,7 +618,7 @@ function parse_Data(dData) dData.j_nano.expanded = null; dData.j_nano.error = null; dData.posh.expanded = null; - dData.posh.error = null; + dData.posh.error = []; doc_URL = dData.docURL; load_restData(doc_URL);