Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefox auto-import breaks if profile name does not end with .default #212

Closed
shv-q3 opened this issue Sep 19, 2017 · 12 comments
Closed

Firefox auto-import breaks if profile name does not end with .default #212

shv-q3 opened this issue Sep 19, 2017 · 12 comments

Comments

@shv-q3
Copy link
Contributor

shv-q3 commented Sep 19, 2017

Firefox auto-imprt breaks if profile name does not end with .default, with firefox profile name like 4r3pvu9s.default-1478290660929 this happens:

./buku.py --ai
Traceback (most recent call last):
File "./buku.py", line 4338, in
main()
File "./buku.py", line 4288, in main
bdb.auto_import_from_browser()
File "./buku.py", line 2175, in auto_import_from_browser
profile = get_firefox_profile_name(DEFAULT_FF_FOLDER)
File "./buku.py", line 2571, in get_firefox_profile_name
profile = [name[:-8] for name in names if name.endswith('.default')][0]
IndexError: list index out of range

I tested many profile names and all that does not end with .default return error
so the solution could be reading profile names from profiles.ini in mozilla profile folder.
I did tests only on arch linux, dont know for other distros

@alex-bender
Copy link
Contributor

Thank you for the submitting report. I'll look at this issue. We decided only look for default file names, and I didn't expect that such format exists.

@jarun
Copy link
Owner

jarun commented Sep 20, 2017

@shv-q3 on which platform is this happening?

@alex-bender from the contents of profiles.ini it seems the default profile comes with a line Default=1. I think we should change get_firefox_profile_name() to return the full Path (from the line Path=6i3qgjrr.default where Default=1) and use it.

@jarun jarun closed this as completed in a659ebe Sep 20, 2017
@jarun
Copy link
Owner

jarun commented Sep 20, 2017

@shv-q3 can you please test the patch and confirm it works for you?

@alex-bender I have pushed this interim patch because there was no timeline from you by when you'll be able to fix this critical issue.

If you are interested in implementing reading from the profiles.ini to get the default directory please let me know by when you'll be able to finish it.

@jarun jarun mentioned this issue Sep 20, 2017
42 tasks
@alex-bender
Copy link
Contributor

@jarun Hi! I would like to take it but I want to discuss it with you first. It was my initial idea to read
profiles.ini file, but we rejected it. Would you be available today for chat?

shv-q3 on which platform is this happening?

I did tests only on arch linux, dont know for other distros

@jarun
Copy link
Owner

jarun commented Sep 20, 2017

Yes, I wasn't aware of the fact that the ini file says explicitly which is the default profile. As I see it's there, and is a good way to figure out the default profile.

I am not sure when I will be available. Just leave your questions here.

Also, the platform may not be relevant. You can backup your .mozilla directory and make changes inside to match the scenario. As long as you don't run Firefox in between and replace back the original directory everything should be fine.

@alex-bender
Copy link
Contributor

So do you want me to just parse raw ini file or use configparser module?

@jarun
Copy link
Owner

jarun commented Sep 20, 2017

Raw parse. No extra deps.

@jarun
Copy link
Owner

jarun commented Sep 20, 2017

Otherwise, is configparser module installed by default with python? In that case do a local import.

@alex-bender
Copy link
Contributor

@jarun yeah, it's default module.

do a local import.

Ok

@jarun jarun changed the title Firefox auto-imprt breaks if profile name does not end with .default Firefox auto-import breaks if profile name does not end with .default Sep 20, 2017
@shv-q3
Copy link
Contributor Author

shv-q3 commented Sep 20, 2017

@alex-bender @jarun
I did manage to rewrite get_firefox_profile_name(path) and get it to work but still did not test other distros then linux can you please check it out link to change and let me know what you think

@alex-bender
Copy link
Contributor

@shv-q3 lets wait jarun. Your comment looks a bit obscure for me.
Also, pay attention that there is a logerr function and use os.paht.join instead of iniprof = path + '/profiles.ini'.

@jarun
Copy link
Owner

jarun commented Sep 20, 2017

@shv-q3 Alex has raised a review already so I'm checking that. Please feel free to review the PR.

@jarun jarun mentioned this issue Nov 11, 2017
48 tasks
@jarun jarun mentioned this issue Mar 16, 2018
49 tasks
@jarun jarun mentioned this issue Apr 21, 2018
61 tasks
@jarun jarun mentioned this issue Dec 29, 2018
66 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Jun 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants