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

Profile names with leading or trailing space could confuse rule lists and other stuff #778

Closed
HamishMacEwan opened this issue May 21, 2016 · 8 comments
Assignees
Labels

Comments

@HamishMacEwan
Copy link

When I try to leave "Edit source code mode" there is an error message:

" Unknown profile: Jimmy"

Which is wrong as there is a profile with that name:
switchyomega profiles screenshot from 2016-05-21 14 16 06

The extension continues to work otherwise. Any assistance gratefully received.

SwitchyOmega 2.3.19
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36

@FelisCatus
Copy link
Owner

Can you export a backup file for your options? That button can be found in Options > Import/Export.

If you can"t leave the profile page, you can copy and paste the following URL into your address bar, which should lead you to the Import/Export page.

chrome-extension://padekgcemlokbadohgkifijomclgjgif/options.html#/io

Please also copy & paste the content in the source code textarea so I can see what"s going wrong.

@HamishMacEwan
Copy link
Author

HamishMacEwan commented May 23, 2016

On 23 May 2016 at 18:50, Felis Catus notifications@github.com wrote:

Can you export a backup file for your options? That button can be found in Options > Import/Export.

For privacy I"d rather not publish that publicly.

If you can"t leave the profile page, you can copy and paste the following URL into your address bar, which should lead you to the Import/Export page.

I can leave the profile page, thank you for the tip though.

Please also copy & paste the content in the source code textarea so I can see what"s going wrong.

Here"s a sample:

[SwitchyOmega Conditions]
@with result

.blockseer.com +Jimmy
*.blockcypher.com +Jimmy
www.noreply.org +Tunnelr
gilc.org +Tunnelr
www.asstr.org +Tunnelr
bitpay.com +Tunnelr
uploaded.net +Tunnelr
UrlWildcard: *depositfiles.com/
+Tunnelr
.uploadable.ch +Jimmy
UrlRegex: .
://.uploaded.to/. +Tunnelr
turbobit.net +direct
www.wupload.com +Tunnelr
UrlWildcard: filesonic +Tunnelr
www.tourtech.ca +Tunnelr
UrlWildcard: .://..target.myresolver.info/.* +Tunnelr
www.safebilling.com +Tunnelr
.
.
.

  • +direct

Reply to this email directly or view it on GitHub

Hope that helps.

Hamish.

https://www.onename.io/hamishmacewan

@FelisCatus
Copy link
Owner

For privacy I"d rather not publish that publicly.

I understand your concern. In that case, could you please change all server address/port to 127.0.0.1 or other random numbers to protect your privacy? You can also just edit the exported file as plain text and replace all the digits with 0.

I apologize if I"m asking for too much, but a full backup is critical for me to reproduce the problem on my side. This issue surely has a lot to do with existing profiles, rules and their names.

Also, does it help to truncate the source code down to the following lines? (Please backup the source code to somewhere safe before you try any of these code below! Otherwise you could lose the existing rules.)

[SwitchyOmega Conditions]
@with result

*.blockseer.com +Jimmy
* +direct

If not, how about removing all rules but the default line? Like below:

[SwitchyOmega Conditions]
@with result

* +direct

@HamishMacEwan
Copy link
Author

On 24 May 2016 at 01:46, Felis Catus notifications@github.com wrote:

I apologize if I"m asking for too much, but a full backup is critical for me to reproduce the problem on my side. This issue surely has a lot to do with existing profiles, rules and their names.

Hmm, I"ve just noticed this:

chrome-extension://padekgcemlokbadohgkifijomclgjgif/options.html#/profile/Jimmy

"Jimmy " with a trailing blank. None of the other profiles have this.
Eg. chrome-extension://padekgcemlokbadohgkifijomclgjgif/options.html#/profile/Tunnelr

Also, does it help to truncate the source code down to the following lines? (Please backup the source code to somewhere safe before you try any of these code below! Otherwise you could lose the existing rules.)

[SwitchyOmega Conditions]
@with result

*.blockseer.com +Jimmy

  • +direct

I"ll check it out, I"ve had a bit of a problem with a hard drive
failure, should be up and restored in the next couple of days.

If not, how about removing all rules but the default line? Like below:

[SwitchyOmega Conditions]
@with result

  • +direct

I"ll try that too, when the machine is back up.

Hamish.

https://www.onename.io/hamishmacewan

@FelisCatus
Copy link
Owner

I see, then it must be the space in profile name. Could you try to rename the profile to something else and then back to Jimmy (without spaces) and see if that could fix the problem? Most places in SwitchyOmega assume that profile names do not have leading or trailing spaces, so I would suggest fixing them first.

Now I"m wondering how could the space get in there. From my observation, creating and renaming profiles will remove trailing spaces automatically even if you type a hard space in the input box. Did you upgrade from SwitchySharp? Was there a space in the profile name back then?

P.S. I don"t need the backup file now. Also, please don"t try those truncated source code snippets, because they won"t work unless you remove the trailing space first. And after the space is removed, your original source code should just work. There would be no point for trying those.

Thanks!

@HamishMacEwan
Copy link
Author

On 25 May 2016 at 19:23, Felis Catus notifications@github.com wrote:

I see, then it must be the space in profile name. Could you try to rename the profile to something else and then back to Jimmy (without spaces) and see if that could fix the problem? Most places in SwitchyOmega assume that profile names do not have leading or trailing spaces, so I would suggest fixing them first.

I"d missed that "Rename" until now... but I actually created a new
Profile called "Jimmy" (no space) and that fixed the "Auto Switch"
switch rules source code problem, with the new Jimmy and reddish icon
showing up. Weird having two profiles that looked identical, but hey,
not as bad as: http://blogs.perl.org/users/zoffix_znet/2016/05/anguish-invisible-programming-language-and-invisible-data-theft.html

Now I"m wondering how could the space get in there. From my observation, creating and renaming profiles will remove trailing spaces automatically even if you type a hard space in the input box. Did you upgrade from SwitchySharp? Was there a space in the profile name back then?

Yes, I upgraded from SwitchySharp, but I don"t recall if there was a "
" or not at that time.

P.S. I don"t need the backup file now. Also, please don"t try those truncated source code snippets, because they won"t work unless you remove the trailing space first. And after the space is removed, your original source code should just work. There would be no point for trying those.

Roger that. I hoped the observation of at the end would suggest
the problem and solution.

Thanks!

Thank you.

Hamish.

https://www.onename.io/hamishmacewan

@FelisCatus FelisCatus changed the title Profile :: Auto Switch - Switch rules - Stuck "Edit source code mode" Profile names with leading or trailing space could confuse rule lists and other stuff May 26, 2016
@FelisCatus
Copy link
Owner

I"m going to trim the profile name when upgrading from SwitchySharp. For existing profiles, I would leave them alone for now since automatically changing profile names could break a lot of stuff.

I believe everything would be fine with the root cause plugged. Or... not, because users could still import a backup file with weird profile names. Better stop thinking about it.

@FelisCatus FelisCatus self-assigned this May 26, 2016
@FelisCatus FelisCatus added the bug label May 26, 2016
@HamishMacEwan
Copy link
Author

On 26 May 2016 at 17:58, Felis Catus notifications@github.com wrote:

I"m going to trim the profile name when upgrading from SwitchySharp. For existing profiles, I would leave them alone for now since automatically changing profile names could break a lot of stuff.

Or fix... but I see your point. I note one of my profiles ends with
"." but that"s visible and not likely to be overlooked.

I believe everything would be fine with the root cause plugged. Or... not, because users could still import a backup file with weird profile names. Better stop thinking about it.

It seems a pretty rare occurrence, the combination of an invisible
variation in name and the desire to view/modify source in the Auto
Switch profile which contains that problematic profile name. I
wouldn"t take any prophylactic steps.

Hamish.

https://www.onename.io/hamishmacewan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants