Partially implemented absolute links to the same site

This commit is contained in:
Pierre Pronchery 2009-04-27 01:17:44 +00:00
parent 45d92375f0
commit 2b14fd410d

View File

@ -496,8 +496,23 @@ static gchar * _ghtml_make_url(gchar const * base, gchar const * url)
if(base != NULL)
{
if(url[0] == '/')
/* FIXME construct from / of base */
{
if(strncmp("http://", base, 7) == 0)
{
if((b = g_strdup(base)) == NULL)
return NULL;
if((p = strchr(&b[7], '/')) != NULL)
{
*p = '\0';
p = g_strdup_printf("%s%s", b, url);
free(b);
return p;
}
free(b);
}
/* FIXME implement other protocols */
return g_strdup_printf("%s%s", base, url);
}
/* construct from basename */
if((b = strdup(base)) == NULL)
return NULL;