Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zmap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
zmap
Commits
44a9346f
Commit
44a9346f
authored
17 years ago
by
edgrif
Browse files
Options
Downloads
Patches
Plain Diff
add code to translate single quotes to url escape sequences so not misinterpreted by shell.
parent
2b4b2f43
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/zmapUtils/zmapWebBrowser.c
+25
-13
25 additions, 13 deletions
src/zmapUtils/zmapWebBrowser.c
with
25 additions
and
13 deletions
src/zmapUtils/zmapWebBrowser.c
+
25
−
13
View file @
44a9346f
...
...
@@ -26,9 +26,9 @@
*
* Exported functions: See zmapUtils.h
* HISTORY:
* Last edited:
Mar 28
1
5
:0
7
200
6
(edgrif)
* Last edited:
Oct 12
1
1
:0
5
200
7
(edgrif)
* Created: Thu Mar 23 13:35:10 2006 (edgrif)
* CVS info: $Id: zmapWebBrowser.c,v 1.
4
200
6
-1
1-08 09:24:56
edgrif Exp $
* CVS info: $Id: zmapWebBrowser.c,v 1.
5
200
7
-1
0-12 10:37:17
edgrif Exp $
*-------------------------------------------------------------------
*/
...
...
@@ -50,7 +50,7 @@ typedef struct
static
BrowserConfig
findSys2Browser
(
GError
**
error
)
;
static
void
makeBrowserCmd
(
GString
*
cmd
,
BrowserConfig
best_browser
,
char
*
url
)
;
static
char
*
translate
Comma
s
(
char
*
orig_link
)
;
static
char
*
translate
URLChar
s
(
char
*
orig_link
)
;
/* Records information for running a specific browser. The intent here is to add enough
...
...
@@ -150,9 +150,8 @@ gboolean zMapLaunchWebBrowser(char *link, GError **error)
GString
*
sys_cmd
;
int
sys_rc
;
/* Translate any "," to "%2C" see translateCommas() for explanation. */
url
=
translateCommas
(
link
)
;
/* Translate troublesome chars to their url escape sequences, see translateURLChars() for explanation. */
url
=
translateURLChars
(
link
)
;
sys_cmd
=
g_string_sized_new
(
1024
)
;
/* Should be long enough for most urls. */
...
...
@@ -256,26 +255,40 @@ static void makeBrowserCmd(GString *cmd, BrowserConfig best_browser, char *url)
}
/* If we use the netscape or Mozilla "OpenURL" remote commands to display links, then sadly the
* syntax for this command is: "OpenURL(URL[,new-window])" and stupid
* netscape will think that any "," in the url (i.e. lots of cgi links have
/* URL standards provide escape sequences for all chars which gets round problems
* with them being wrongly interpreted. This function translates chars in the url
* that give us problems for various reasons:
*
* If we use the netscape or Mozilla "OpenURL" remote commands to display links, then sadly the
* syntax for this command is: "OpenURL(URL[,new-window])" and stupid
* netscape/mozilla will think that any "," in the url (i.e. lots of cgi links have
* "," to separate args !) is the "," for its OpenURL command and will then
* usually report a syntax error in the OpenURL command.
*
* To get round this we translate any "," into "%2C" which is the standard
* code for a "," in urls (thanks to Roger Pettet for this)....YUCH.
*
* Some urls have single quotes in them, if you pass the whole string through
* to the shell these get wrongly interpreted by the shell in its normal
* string fashion so we translate them all to "%27".
*
*
* The returned string should be g_free'd when no longer needed.
*/
static
char
*
translate
Comma
s
(
char
*
orig_link
)
static
char
*
translate
URLChar
s
(
char
*
orig_link
)
{
char
*
url
=
NULL
;
GString
*
link
;
char
*
target
=
","
;
char
*
source
=
"%2C"
;
char
*
target
,
*
source
;
link
=
g_string_new
(
orig_link
)
;
target
=
","
;
source
=
"%2C"
;
zMap_g_string_replace
(
link
,
target
,
source
)
;
target
=
"'"
;
source
=
"%27"
;
zMap_g_string_replace
(
link
,
target
,
source
)
;
url
=
g_string_free
(
link
,
FALSE
)
;
...
...
@@ -287,4 +300,3 @@ static char *translateCommas(char *orig_link)
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment