commit e68889af45b24896d9dd7845a045718be5efa1a5
parent e901cc1bf39780870cab8b0b30e882d28e405249
Author: adam3smith <karcher@u.northwestern.edu>
Date: Thu, 25 Apr 2013 16:08:59 -0600
put this into the right function
Diffstat:
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js
@@ -211,20 +211,10 @@ Zotero.Attachments = new function(){
parentCollectionIDs = undefined;
}
- /* 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]*$/;
-
+ // Throw error on invalid URLs
+ //
+ // TODO: allow other schemes
+ var urlRe = /^https?:\/\/[^\s]*$/;
var matches = urlRe.exec(url);
if (!matches) {
if(callback) callback(false);
@@ -419,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()");