summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-10-21 10:37:23 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2022-10-21 12:17:23 +0200
commit84552eaf8c50b46ab2c98ad70b6473b4db31baee (patch)
tree2464e435ea4a53c5b61e998e2787e1a6dcc62161 /libreofficekit
parent848f9b2c56ce4c4620f62f1fbf9d12d84ec4da96 (diff)
documentLoadWithOptions takes URLs
m_aDocPath is set in lok_doc_view_set_property from data coming from gtv_application_open's calls to g_file_get_path. So the path is not a proper file URL, which is expected by documentLoadWithOptions. Some Linux paths can happen to be able to convert to absolute URL in rtl::Uri::convertRelToAbs, but not all, and not e.g. Windows paths. Change-Id: I0a17cb84000603336a6809b0179bbda3d54aec23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141579 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index eb06f2608520..0486d16e9213 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -2349,7 +2349,13 @@ openDocumentInThread (gpointer data)
}
priv->m_pOffice->pClass->registerCallback(priv->m_pOffice, globalCallbackWorker, pDocView);
- priv->m_pDocument = priv->m_pOffice->pClass->documentLoadWithOptions( priv->m_pOffice, priv->m_aDocPath.c_str(), "en-US" );
+ std::string url = priv->m_aDocPath;
+ if (gchar* pURL = g_filename_to_uri(url.c_str(), nullptr, nullptr))
+ {
+ url = pURL;
+ g_free(pURL);
+ }
+ priv->m_pDocument = priv->m_pOffice->pClass->documentLoadWithOptions( priv->m_pOffice, url.c_str(), "en-US" );
if ( !priv->m_pDocument )
{
char *pError = priv->m_pOffice->pClass->getError( priv->m_pOffice );