[Pkg-mozext-commits] [automatic-save-folder] 119/133: * Fixed filtering domain using Domain Type 7 (Thanks hiteshsathawane) * Fixed saving webpage with parentheses in the page name. (Might break capture function when capturing elements of filename with odd parentheses numbers in the page name).

David Prévot taffit at moszumanska.debian.org
Mon Apr 27 20:33:58 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch wip
in repository automatic-save-folder.

commit ccd419c90d7d65b0274caaf6e55c998b2e2f4708
Author: Cyan <Cyan at d0063192-6b2e-11de-89a9-0b20f3e2dceb>
Date:   Sun Aug 31 13:33:22 2014 +0000

    * Fixed filtering domain using Domain Type 7
      (Thanks hiteshsathawane)
    * Fixed saving webpage with parentheses in the page name.
      (Might break capture function when capturing elements of
      filename with odd parentheses numbers in the page name).
    
      Not tested a lot. Report if it breaks your existing filters
      and I'll revert it to previous revision.
    
    git-svn-id: http://automatic-save-folder.googlecode.com/svn/trunk@128 d0063192-6b2e-11de-89a9-0b20f3e2dceb
---
 content/asf_download.js     | 24 +++++++++++++++++++++++-
 content/asf_right_click.js  | 24 +++++++++++++++++++++++-
 content/common.dtd          |  2 +-
 defaults/preferences/asf.js |  2 +-
 4 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/content/asf_download.js b/content/asf_download.js
index ec3c791..1a13fcf 100644
--- a/content/asf_download.js
+++ b/content/asf_download.js
@@ -223,9 +223,11 @@ Copyright (C) 2007-2012 Éric Cassar (Cyan).
 						case "7":
 							dom_regexp = this.test_regexp(filters[i][0], tabURL, i, "domain");
 							if (dom_regexp && this.logtoconsole && !this.inPrivateBrowsing) this.console_print("Filter "+i+" matched domain type : 7");
+							break;
 						case "8":
 							dom_regexp = this.test_regexp(filters[i][0], tabGroupName, i, "domain");
 							if (dom_regexp && this.logtoconsole && !this.inPrivateBrowsing) this.console_print("Filter "+i+" matched domain type : 8");
+							break;
 						default:
 					}
 					
@@ -564,6 +566,7 @@ Copyright (C) 2007-2012 Éric Cassar (Cyan).
 		// var tabLocation = currentTab.currentURI.spec;
 		var tabLocation = mainWindow.gBrowser.mCurrentTab.linkedBrowser.contentDocument.location;
 		var tabURL = mainWindow.gURLBar.value;
+		var tabGroupName = this.getActiveGroupName();
 		var currentReferrer = mainWindow.gBrowser.mCurrentTab.linkedBrowser.contentDocument.referrer;
 		
 		var filename =			document.getElementById("location").value ;
@@ -631,6 +634,11 @@ Copyright (C) 2007-2012 Éric Cassar (Cyan).
 				case "7":
 					dom_regexp = this.test_regexp(asf_domain, tabURL, idx, "domain");
 					used_domain_string = tabURL;
+					break;
+				case "8":
+					dom_regexp = this.test_regexp(asf_domain, tabGroupName, idx, "domain");
+					used_domain_string = tabGroupName;
+					break;
 				default:
 			}
 			
@@ -1069,6 +1077,8 @@ Copyright (C) 2007-2012 Éric Cassar (Cyan).
 				.replace(/\|/gi, "\\|")
 				.replace(/\[/gi, "\\[")
 				.replace(/\]/gi, "\\]")
+				.replace(/\(/gi, "\\(")
+				.replace(/\)/gi, "\\)")
 				.replace(/\//gi, "\\/");
 		var test_regexp = new RegExp("^"+val+"$");
 		var data = "";
@@ -1203,6 +1213,7 @@ Copyright (C) 2007-2012 Éric Cassar (Cyan).
 													.replace(/\?/gi, ".")
 													.replace(/\|/gi, "\\|")
 													.replace(/\[/gi, "\\[")
+													.replace(/\]/gi, "\\]")
 													.replace(/\//gi, "\\/");
 			filter_data = ".*"+filter_data+".*";
 		}
@@ -1214,7 +1225,18 @@ Copyright (C) 2007-2012 Éric Cassar (Cyan).
 			var test = new RegExp(filter_data, param);
 		}
 		catch(e){
-			alert('\t\tAutomatic Save Folder\n\n-'+e.message+'\nin filter N°'+idx+':\n'+filter_data+'\nregular expression: '+isregexp)
+			
+			// try to fix parentheses if not used for catching purpose (odd number of parentheses). currently replacing all instances, breaking existing catches.
+			filter_data = filter_data.replace(/\(/gi, "\\(")
+									 .replace(/\)/gi, "\\)");
+			
+			try
+			{
+				test = new RegExp(filter_data, param);
+			}
+			catch(e){
+				alert('\t\tAutomatic Save Folder\n\n-'+e.message+'\nin filter N°'+idx+':\n'+filter_data+'\nregular expression: '+isregexp)
+			}
 		}
 		
 		// Thanks to Ted Gifford for the regular expression capture.
diff --git a/content/asf_right_click.js b/content/asf_right_click.js
index fbdfad8..deec95d 100644
--- a/content/asf_right_click.js
+++ b/content/asf_right_click.js
@@ -283,9 +283,11 @@ var automatic_save_folder = {
 						case "7":
 							dom_regexp = this.test_regexp(filters[i][0], tabURL, i, "domain");
 							if (dom_regexp && this.logtoconsole && !this.inPrivateBrowsing) this.console_print("Filter "+i+" matched domain type : 7");
+							break;
 						case "8":
 							dom_regexp = this.test_regexp(filters[i][0], tabGroupName, i, "domain");
 							if (dom_regexp && this.logtoconsole && !this.inPrivateBrowsing) this.console_print("Filter "+i+" matched domain type : 8");
+							break;
 						default:
 					}
 					
@@ -522,6 +524,7 @@ var automatic_save_folder = {
 		var mainWindow = wm.getMostRecentWindow("navigator:browser");
 		
 		var tabURL = mainWindow.gURLBar.value;
+		var tabGroupName = this.getActiveGroupName();
 		var currentReferrer = mainWindow.gBrowser.mCurrentTab.linkedBrowser.contentDocument.referrer;
 		
 		var tabLocation = 	mainWindow.gBrowser.mCurrentTab.linkedBrowser.contentDocument.location;
@@ -598,6 +601,11 @@ var automatic_save_folder = {
 				case "7":
 					dom_regexp = this.test_regexp(asf_domain, tabURL, idx, "domain");
 					used_domain_string = tabURL;
+					break;
+				case "8":
+					dom_regexp = this.test_regexp(asf_domain, tabGroupName, idx, "domain");
+					used_domain_string = tabGroupName;
+					break;
 				default:
 			}
 			
@@ -794,6 +802,8 @@ var automatic_save_folder = {
 				.replace(/\|/gi, "\\|")
 				.replace(/\[/gi, "\\[")
 				.replace(/\]/gi, "\\]")
+				.replace(/\(/gi, "\\(")
+				.replace(/\)/gi, "\\)")
 				.replace(/\//gi, "\\/");
 		var test_regexp = new RegExp("^"+val+"$");
 		var data = "";
@@ -830,6 +840,7 @@ var automatic_save_folder = {
 													.replace(/\?/gi, ".")
 													.replace(/\|/gi, "\\|")
 													.replace(/\[/gi, "\\[")
+													.replace(/\]/gi, "\\]")
 													.replace(/\//gi, "\\/");
 			filter_data = ".*"+filter_data+".*";
 		}
@@ -841,7 +852,18 @@ var automatic_save_folder = {
 			var test = new RegExp(filter_data, param);
 		}
 		catch(e){
-			alert('\t\tAutomatic Save Folder\n\n-'+e.message+'\nin filter N°'+idx+':\n'+filter_data+'\nregular expression: '+isregexp)
+		
+			// try to fix parentheses if not used for catching purpose (odd number of parentheses). currently replacing all instances, breaking existing catches.
+			filter_data = filter_data.replace(/\(/gi, "\\(")
+									 .replace(/\)/gi, "\\)");
+			
+			try
+			{
+				test = new RegExp(filter_data, param);
+			}
+			catch(e){
+				alert('\t\tAutomatic Save Folder\n\n-'+e.message+'\nin filter N°'+idx+':\n'+filter_data+'\nregular expression: '+isregexp)
+			}
 		}
 		
 		// Thanks to Ted Gifford for the regular expression capture.
diff --git a/content/common.dtd b/content/common.dtd
index 45c61af..6bd3465 100644
--- a/content/common.dtd
+++ b/content/common.dtd
@@ -1,7 +1,7 @@
 <!-- Strings which don't need a translation -->
 
 <!-- Current version -->
-<!ENTITY asf.version "1.0.5bRev127">
+<!ENTITY asf.version "1.0.5bRev128">
 
 <!ENTITY about.translators "
 - cs : Stanislav Horáček<br />
diff --git a/defaults/preferences/asf.js b/defaults/preferences/asf.js
index a106e0f..df5aeed 100644
--- a/defaults/preferences/asf.js
+++ b/defaults/preferences/asf.js
@@ -1,4 +1,4 @@
- pref("extensions.asf.currentVersion", "1.0.5bRev127");
+ pref("extensions.asf.currentVersion", "1.0.5bRev128");
  pref("extensions.asf.lastdir", true);
  pref("extensions.asf.keeptemp", true);
  pref("extensions.asf.viewdloption", false);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/automatic-save-folder.git



More information about the Pkg-mozext-commits mailing list