Username and password are stripped from FTP urls
-
Deleted User last edited by
At my company we use ftp links (ftp://username:password@hostname) for connecting to the servers we manage. I'm trying to configure opera to open these links in an external application however, it appears that Opera strips the username and password from the url leaving just fpt://hostname.
Is there anyway to stop this happening?
Chris.
-
sgunhouse Moderator Volunteer last edited by
I presume you are using 12.16, and not the current beta? (I don't think there is even an option in 25 to configure external programs.) The answer is, probably not - Opera is paranoid about handing passwords to other software. I sure don't see any option that might be useful in opera:config. Though I'll have to look up and see if there is an optional parameter that might work.
-
burnout426 Volunteer last edited by
I don't remember if there's an option in opera:config to control this, but if there isn't, you can try something like the following as a workaround:
Goto "Alt + P -> advanced -> programs" and add an unknown protocol like fftp. Use its "open with other application" option and set it to launch a command line script. The script just needs to get the argument Opera passes to it, which will be the URL. Then, the script just needs to strip the first 'f' off the beginning and pass the ftp URL to the program you want.
The reason that will work is Opera won't strip the login info for unknown protocols.
Now, if the ftp links are in anchor elements on a web page, you can create a UserJS script that runs through all the ftp links on the page and changes them to fftp links so that your fftp handler is triggered when you click them. In the UserJS script, you'll need to use el.getAttribute("href") to get the version that has the username:password@ part in it as the .href property will have it stripped.
Or, if you want to skip all that (including skipping the adding the new protocol), goto "Alt + P -> advanced -> toolbars -> Menu setup section -> Opera Standard" and click "Duplicate". Then, go into "~/opera/menu" (or "~/opera/profile/menu", I forget) and edit the standard_menu(1).ini file. You'll want to do something like this:
Under the Link Popup Menu section, you'll want to add:
Item, "Test"=Copy Link & Execute Program, "path to your script", "%c"
Then, after you restart Opera or switch to another menu and then back, when you right-click on ftp links (on web pages at least, not sure about ftp pages), you'll get a new option named test which will pass the URL (with the login info in tact) to your script (or just the ftp program directly if you specify that in the execute program path).
That does put the URL on the clipboard though. there is %l (el, not one) to do it without copying to the clipboard, but that version has the login info stripped. And, FYI, if you use uppercase (C for example), Opera will add quotes *as part of the argument value, which each will be escaped by \ when the argument is quoted and passed on the command line. Not sure if you'll want the extra quotes, but the option's there.
If you want to do this for plain text (not an anchor element), you can add about the same thing to the Hotclick Popup Menu section. Something like:
Item, "Test"=Copy & Execute Program, "path to your script", "%c"
You can probably add that last one to the Link Selection Popup Menu section too if you want.