commit bbf066f55aaeb4e4e80970db06cc4e95e854e911
parent 9c82a7a661810a5408997aa7d87ef6928944b09e
Author: Dan Stillman <dstillman@gmail.com>
Date: Tue, 14 May 2013 00:06:42 -0700
Merge pull request #313 from adam3smith/adduris
add more item handler protocols to add by URI
Diffstat:
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js
@@ -212,7 +212,7 @@ Zotero.Attachments = new function(){
}
// Throw error on invalid URLs
- //
+ //
// TODO: allow other schemes
var urlRe = /^https?:\/\/[^\s]*$/;
var matches = urlRe.exec(url);
@@ -409,9 +409,20 @@ Zotero.Attachments = new function(){
*/
function linkFromURL(url, sourceItemID, mimeType, title){
Zotero.debug('Linking attachment from URL');
-
- // Throw error on invalid URLs
- var urlRe = /^https?:\/\/[^\s]*$/;
+
+ /* Throw error on invalid URLs
+ We currently accept the following protocols:
+ PersonalBrain (brain://)
+ DevonThink (x-devonthink-item://)
+ Notational Velocity (nv://)
+ MyLife Organized (mlo://)
+ Evernote (evernote://)
+ OneNote (onenote://)
+ Kindle (kindle://)
+ Logos (logosres:)
+ Zotero (zotero://) */
+
+ var urlRe = /^((https?|zotero|evernote|onenote|brain|nv|mlo|kindle|x-devonthink-item|ftp):\/\/|logosres:)[^\s]*$/;
var matches = urlRe.exec(url);
if (!matches) {
throw ("Invalid URL '" + url + "' in Zotero.Attachments.linkFromURL()");