From 8ff4d1473da72e93780385acf193300ae9134af1 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 11 Apr 2020 06:49:10 +0200 Subject: Handle file:/// URLs as local paths in --start-at --- src/options.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/options.c b/src/options.c index 19f8db9..5426a0b 100644 --- a/src/options.c +++ b/src/options.c @@ -849,9 +849,18 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun) } } else if (finalrun && !opt.filelistfile && !opt.bgmode) { - if (opt.start_list_at && path_is_url(opt.start_list_at)) { + /* + * if --start-at is a non-local URL (i.e., does not start with file:///), + * behave as if "feh URL" was called (there is no directory we can load) + */ + if (opt.start_list_at && path_is_url(opt.start_list_at) && (strlen(opt.start_list_at) <= 8 || strncmp(opt.start_list_at, "file:///", 8) != 0)) { add_file_to_filelist_recursively(opt.start_list_at, FILELIST_FIRST); } else if (opt.start_list_at && strrchr(opt.start_list_at, '/')) { + if (strlen(opt.start_list_at) > 8 && strncmp(opt.start_list_at, "file:///", 8) == 0) { + char *start_at_path = estrdup(opt.start_list_at + 7); + free(opt.start_list_at); + opt.start_list_at = start_at_path; + } char *target_directory = estrdup(opt.start_list_at); char *filename_start = strrchr(target_directory, '/'); if (filename_start) { -- cgit v1.2.3