You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
Clipper: Set source URL and fixed issues with tables and urls
This commit is contained in:
@@ -37,7 +37,7 @@ class ClipperServer {
|
||||
body: requestNote.body ? requestNote.body : '',
|
||||
};
|
||||
|
||||
if (requestNote.bodyHtml) {
|
||||
if (requestNote.bodyHtml) {
|
||||
// Parsing will not work if the HTML is not wrapped in a top level tag, which is not guaranteed
|
||||
// when getting the content from elsewhere. So here wrap it - it won't change anything to the final
|
||||
// rendering but it makes sure everything will be parsed.
|
||||
@@ -54,6 +54,8 @@ class ClipperServer {
|
||||
output.parent_id = folder.id;
|
||||
}
|
||||
|
||||
if (requestNote.url) output.source_url = requestNote.url;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,15 +18,13 @@ urlUtils.urlProtocol = function(url) {
|
||||
return parsed.protocol;
|
||||
}
|
||||
|
||||
const schemeRegex = /^[a-zA-Z0-9\+\-\.]+:\/\//
|
||||
urlUtils.prependBaseUrl = function(url, baseUrl) {
|
||||
baseUrl = rtrimSlashes(baseUrl).trim(); // All the code below assumes that the baseUrl does not end up with a slash
|
||||
url = url.trim();
|
||||
|
||||
if (!url) url = '';
|
||||
if (!baseUrl) return url;
|
||||
const matches = schemeRegex.exec(url);
|
||||
if (matches) return url; // Don't prepend the base URL if the URL already has a scheme
|
||||
if (urlUtils.urlProtocol(url)) return url; // Don't prepend the base URL if the URL already has a scheme
|
||||
|
||||
if (url.length >= 2 && url.indexOf('//') === 0) { // If it starts with // it's a protcol-relative URL
|
||||
return urlUtils.urlProtocol(baseUrl) + url;
|
||||
|
||||
Reference in New Issue
Block a user