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
This commit is contained in:
Matthias Clasen
2018-10-07 19:49:06 -04:00
committed by Alexander Larsson
parent 45c7f5071c
commit 9e090b845a

View File

@@ -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)