Move unique_filename_from_url functions to common

This commit is contained in:
William Wennerström
2020-12-04 16:13:13 +01:00
parent 3a6597ee29
commit 1d2c0a8836
13 changed files with 172 additions and 167 deletions

View File

@@ -44,25 +44,6 @@
#define FALLBACK_MSG ""
char*
http_basename_from_url(const char* url)
{
const char* default_name = "index.html";
GFile* file = g_file_new_for_uri(url);
char* filename = g_file_get_basename(file);
g_object_unref(file);
if (g_strcmp0(filename, ".") == 0
|| g_strcmp0(filename, "..") == 0
|| g_strcmp0(filename, G_DIR_SEPARATOR_S) == 0) {
g_free(filename);
return strdup(default_name);
}
return filename;
}
void
http_print_transfer_update(ProfWin* window, char* url, const char* fmt, ...)
{

View File

@@ -38,9 +38,7 @@
#include "ui/window.h"
char* http_basename_from_url(const char* url);
void http_print_transfer(ProfWin* window, char* url, const char* fmt, ...);
void http_print_transfer_update(ProfWin* window, char* url, const char* fmt, ...);
gchar** http_format_external_argv(const char* cmd, const char* url, const char* filename);
#endif