From 9e090b845a8668c9cb8d3f8ca77dea2ef205bad8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 7 Oct 2018 19:49:06 -0400 Subject: [PATCH] document-unexport: Allow unexporting by docid If the backing document has been deleted, then looking up the doc-id fails. To work around this, allow specifying the doc-id directly. Closes: #1897 --- app/flatpak-builtins-document-unexport.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/flatpak-builtins-document-unexport.c b/app/flatpak-builtins-document-unexport.c index 0b108c82..402544ab 100644 --- a/app/flatpak-builtins-document-unexport.c +++ b/app/flatpak-builtins-document-unexport.c @@ -37,7 +37,10 @@ #include "flatpak-utils-private.h" #include "flatpak-run-private.h" +static gboolean opt_docid; + static GOptionEntry options[] = { + { "docid", 0, 0, G_OPTION_ARG_NONE, &opt_docid, N_("Specify the document ID"), NULL }, { NULL } }; @@ -79,7 +82,9 @@ flatpak_builtin_document_unexport (int argc, char **argv, if (documents == NULL) return FALSE; - if (!xdp_dbus_documents_call_lookup_sync (documents, file, &doc_id, NULL, error)) + if (opt_docid) + doc_id = g_strdup (file); + else if (!xdp_dbus_documents_call_lookup_sync (documents, file, &doc_id, NULL, error)) return FALSE; if (strcmp (doc_id, "") == 0)