Support local file urls
This commit is contained in:
parent
bcac5268b9
commit
66f56d699b
19
dialog.c
19
dialog.c
|
@ -160,12 +160,19 @@ int UIAddFeed (char* newurl)
|
|||
|
||||
CleanupString (url, false);
|
||||
|
||||
// Support that stupid feed:// "protocol"
|
||||
if (strncasecmp (url, "feed://", 7) == 0)
|
||||
memcpy (url, "http", 4);
|
||||
|
||||
// If URL does not start with the procotol specification, assume http://
|
||||
if (strncasecmp (url, "http://", 7) != 0 && strncasecmp (url, "https://", 8) != 0 && strncasecmp (url, "exec:", 5) != 0) {
|
||||
if (url[0] == '/') {
|
||||
// Prefix file paths with file://
|
||||
char* fileurl = malloc (strlen ("file://") + strlen (url) + 1);
|
||||
sprintf (fileurl, "file://%s", url);
|
||||
free (url);
|
||||
url = fileurl;
|
||||
} else if (strncasecmp (url, "feed://", 7) == 0)
|
||||
memcpy (url, "http", 4); // feed:// is http
|
||||
else if (strncasecmp (url, "http://", 7) != 0
|
||||
&& strncasecmp (url, "https://", 8) != 0
|
||||
&& strncasecmp (url, "file://", 7) != 0
|
||||
&& strncasecmp (url, "exec:", 5) != 0) {
|
||||
// If URL does not start with the procotol specification, assume http://
|
||||
char* httpurl = malloc (strlen ("http://") + strlen (url) + 1);
|
||||
sprintf (httpurl, "http://%s", url);
|
||||
free (url);
|
||||
|
|
Loading…
Reference in New Issue