Author Topic: Misleading error when importing settings  (Read 11697 times)

Offline bigpresh

  • Normal Members
  • *
  • Posts: 5
Misleading error when importing settings
« on: October 18, 2005, 09:43:25 PM »
I was trying to export my settings from my copy of Firefox at work and import into my copy of Firefox at home.

I did "Export Settings" at work, when asked for a filename to save the settings to I entered simply 'pwmakersettings'.

I copied that file to home, selected "Import Settings" and selected that file, but received the error:

Code: [Select]
/home/davidp/pwmakersettings is not a valid PasswordMaker file. Import canceled.

After a bit of trial and error, I found out that the problem was actually that PasswordMaker expected the file to have a .rdf extension.  Renaming it to pwmakersettings.rdf allowed the settings to be imported successfully.

I feel the '... is not a valid PasswordMaker file' error message is not clear enough as to the problem, and it might be a worthwhile idea for the import to either disregard the file extension, or make it clear that it's rejecting the file because it does not have the expected extension.

Thoughts anyone?

Offline Romeo

  • Hero Member
  • *****
  • Posts: 561
Misleading error when importing settings
« Reply #1 on: October 18, 2005, 09:48:24 PM »
Quote
After a bit of trial and error, I found out that the problem was actually that PasswordMaker expected the file to have a .rdf extension.
Yeah, I noticed that too.  May be Eric could have PM write out the 'settings' with .rdf by default ?
It is impossible to create a fool-proof system, because fools are ingenious.

Offline bigpresh

  • Normal Members
  • *
  • Posts: 5
Misleading error when importing settings
« Reply #2 on: October 18, 2005, 10:13:30 PM »
I've just had a dig around the source, and it looks to me that the requirement for the file to end .rdf may be to do with some part of FF that PM uses to parse the file (could be wrong though, didn't dig that deeply).

Perhaps a suitable and easy solution would be just to check that the file extension is .rdf before validating whether the file can be imported.

I've done a quick example, which I haven't had a chance to test yet, but below is a diff to illustrate what I'm thinking of.

Eric or anyone else, what's your thoughts on this?  If you think  this is a suitable fix, I don't mind testing it out and verifying it works, and making whatever changes are required.

Right, the diff to illustrate is:

Code: [Select]
bash-2.05b$ diff -u passwdmakerOverlay.js-orig passwdmakerOverlay.js
--- passwdmakerOverlay.js-orig  2005-10-18 23:03:40.000000000 +0100
+++ passwdmakerOverlay.js       2005-10-18 23:15:13.000000000 +0100
@@ -308,6 +308,12 @@
       f1.copyTo(f2, fp.file.leafName);
     }
     else {
+
+    if (file.path.substr(file.path.length -4) != '.rdf') {
+               passwordMakerHelper.prompts.alert(this, "PasswordMaker", "PasswordMaker settings file must have .rdf extension. Import cancelled.");
+       }
+
+    
       if (!validateImportFile(fp.file)) {
         passwordMakerHelper.prompts.alert(this, "PasswordMaker", fp.file.path + " is not a valid PasswordMaker file. Import canceled.");
         return false;


Offline Eric H. Jung

  • grimholtz
  • Administrator
  • *****
  • Posts: 3353
Misleading error when importing settings
« Reply #3 on: October 18, 2005, 10:43:42 PM »
Hi bigpresh,
Good catch. You are right. Components.interfaces.nsIIOService.newFileURI(), part of the Mozilla/FF API, seems to require the file to have an RDF extension. Your patch looks good. I'll put it in right now and test it--no need for you to do it.

Thanks for the contribution!!

Regards,
Eric
« Last Edit: October 18, 2005, 10:43:59 PM by Eric H. Jung »

Offline Eric H. Jung

  • grimholtz
  • Administrator
  • *****
  • Posts: 3353
Misleading error when importing settings
« Reply #4 on: October 18, 2005, 10:51:21 PM »
Fixed. The exact change was:

(added lines only)
Code: [Select]
if (fp.file.path.substr(fp.file.path.length -4) != ".rdf") {
  passwordMakerHelper.prompts.alert(this, "PasswordMaker",
  "PasswordMaker settings files must have .rdf extensions. Please rename the file and try again. Import cancelled.");
  return false;
}

It will be in the next release. Thanks agian, bigpresh.

-Eric

Offline bigpresh

  • Normal Members
  • *
  • Posts: 5
Misleading error when importing settings
« Reply #5 on: October 18, 2005, 11:04:24 PM »
Quote
Fixed. The exact change was:

(added lines only)
Code: [Select]
if (fp.file.path.substr(fp.file.path.length -4) != ".rdf") {
  passwordMakerHelper.prompts.alert(this, "PasswordMaker",
  "PasswordMaker settings files must have .rdf extensions. Please rename the file and try again. Import cancelled.");
  return false;
}

It will be in the next release. Thanks agian, bigpresh.

-Eric

Wow - that was a VERY fast response, I'm impressed!

Thanks for creating such a useful extension, and I'm glad to have been able to help a little.

Offline Romeo

  • Hero Member
  • *****
  • Posts: 561
Misleading error when importing settings
« Reply #6 on: October 18, 2005, 11:35:09 PM »
Quote
May be Eric could have PM write out the 'settings' with .rdf by default ?
What you guys have done, may be a good after the fact fix.  However, I was thinking that this should be caught before it is saved.  In other words, do it in a similar fashion as notepad or other apps do it.  When you just type a filename, it automatically adds the extension.

Because what good is the after the fact check, if I am hundreds of miles away and want to import my rdf file from a floppy or an email and it don't work.  I would be out of luck, right?
It is impossible to create a fool-proof system, because fools are ingenious.

Offline Eric H. Jung

  • grimholtz
  • Administrator
  • *****
  • Posts: 3353
Misleading error when importing settings
« Reply #7 on: October 19, 2005, 01:24:26 AM »
Romeo, in my testing PasswordMaker automatically adds the .rdf extension when exporting. Let me know if that's not happening for you.

Quote
Because what good is the after the fact check, if I am hundreds of miles away and want to import my rdf file from a floppy or an email and it don't work. I would be out of luck, right?
All you must do is rename the file to *.rdf.

Offline Romeo

  • Hero Member
  • *****
  • Posts: 561
Misleading error when importing settings
« Reply #8 on: October 19, 2005, 01:33:46 AM »
Quote
Romeo, in my testing PasswordMaker automatically adds the .rdf extension when exporting. Let me know if that's not happening for you.


All you must do is rename the file to *.rdf.
Why didn't I think about renaming it ?  I guess I was being overly dramatic here, wasn't I?  I gues my daughter is rubbing off on me.

And yes, you are absolutely correct, it does add the rdf extension, when you do not specify an extension.

Thanks for clearing that up.
« Last Edit: October 19, 2005, 01:34:04 AM by Romeo »
It is impossible to create a fool-proof system, because fools are ingenious.

Offline Romeo

  • Hero Member
  • *****
  • Posts: 561
Misleading error when importing settings
« Reply #9 on: October 19, 2005, 01:39:37 AM »
Since we are talking about exporting, I think it might be a nice to be able to export certain groups.  In other words, when group one is higlighted, you can export it as group 1.rdf, etc.

This would be especially useful, after we are able to move around accounts by drag and drop.  Then one could share certain groups with friends, and the like.  Currently, I import my export into my test account, blow away the accounts, which I do not want to share, export it, and then share it.
It is impossible to create a fool-proof system, because fools are ingenious.

Offline Eric H. Jung

  • grimholtz
  • Administrator
  • *****
  • Posts: 3353
Misleading error when importing settings
« Reply #10 on: October 19, 2005, 02:00:39 AM »
Sounds good. Can you post it to the Feature Request forum (or move that post if you have the privs)
« Last Edit: October 19, 2005, 02:01:05 AM by Eric H. Jung »

PasswordMaker Forums

Misleading error when importing settings
« Reply #10 on: October 19, 2005, 02:00:39 AM »