diff options
author | Matthias Clasen <mclasen@redhat.com> | 2018-10-17 17:17:21 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2018-10-17 17:53:50 -0400 |
commit | aacc64915877f8938358e57cde6382573df6dbaa (patch) | |
tree | e46f4785d2fbb2b9c0946bef83b0f6366a7714fd | |
parent | dcd912b463895d3d0489b1429e545bb7b806b25e (diff) | |
download | flatpak-aacc64915877f8938358e57cde6382573df6dbaa.tar.gz |
build-bundle: Improve error handling
Don't fail in obscure ways if commandline options don't
look like files.
Closes: #2191
-rw-r--r-- | app/flatpak-builtins-build-bundle.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/flatpak-builtins-build-bundle.c b/app/flatpak-builtins-build-bundle.c index c4af1d25..281d39ea 100644 --- a/app/flatpak-builtins-build-bundle.c +++ b/app/flatpak-builtins-build-bundle.c @@ -574,9 +574,10 @@ flatpak_builtin_build_bundle (int argc, char **argv, GCancellable *cancellable, return flatpak_fail (error, _("'%s' is not a valid repository"), location); if (!ostree_repo_open (repo, cancellable, error)) - return FALSE; - - file = g_file_new_for_commandline_arg (filename); + { + g_prefix_error (error, _("'%s' is not a valid repository: "), location); + return FALSE; + } if (ostree_repo_resolve_rev (repo, name, FALSE, NULL, NULL)) full_branch = g_strdup (name); @@ -594,6 +595,11 @@ flatpak_builtin_build_bundle (int argc, char **argv, GCancellable *cancellable, full_branch = flatpak_build_app_ref (name, branch, opt_arch); } + file = g_file_new_for_commandline_arg (filename); + + if (flatpak_file_get_path_cached (file) == NULL) + return flatpak_fail (error, _("'%s' is not a valid filename"), filename); + if (opt_oci) { if (!build_oci (repo, file, name, full_branch, cancellable, error)) |