Fixed wrong download path for pages with trailing /.
authorDaniel Carl <danielcarl@gmx.de>
Thu, 27 Feb 2014 22:07:02 +0000 (23:07 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Thu, 27 Feb 2014 22:07:02 +0000 (23:07 +0100)
If a page has a URL with a trailing slash, the suggested file name was an
empty string. But we appended this empty string as file to the download
directory path, so vimb tries to save the download under a directory path an
not a file.
This patch checks the case where the filename is empty so that the default
download file name can be used.

src/main.c

index 6e807ee..8532898 100644 (file)
@@ -917,7 +917,7 @@ gboolean vb_download(WebKitWebView *view, WebKitDownload *download, const char *
         file = util_build_path(path, vb.config.download_dir);
     } else {
         path = webkit_download_get_suggested_filename(download);
-        if (!path) {
+        if (!path || *path == '\0') {
             path = PROJECT "-donwload";
         }
         file = util_build_path(path, vb.config.download_dir);