Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try harder to find the host path for the documents #1571

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

xhorak
Copy link
Contributor

@xhorak xhorak commented Jan 15, 2025

When the access to the directory is provided by the portal (like browser download directory) the stored files in the directory are not found by xdp_get_real_path_for_doc_path and /run/user/... path is opened instead of host path by the OpenFile or OpenDirectory portal.

src/open-uri.c Outdated Show resolved Hide resolved
src/open-uri.c Outdated Show resolved Hide resolved
@xhorak xhorak force-pushed the openuri-tryharder branch from f2371db to fd24f44 Compare January 20, 2025 13:02
tests/notification.c Outdated Show resolved Hide resolved
When the access to the directory is provided by the portal (like
browser download directory) the stored files in the directory
are not found by xdp_get_real_path_for_doc_path and /run/user/...
path is opened instead of host path by the OpenFile or OpenDirectory portal.
This fix tries to recreate host path from the document id and
rest of the given path.
@xhorak xhorak force-pushed the openuri-tryharder branch from fd24f44 to 27194b7 Compare January 20, 2025 13:40
@swick
Copy link
Contributor

swick commented Jan 20, 2025

Not a full review but changes like this really need tests.

@swick
Copy link
Contributor

swick commented Jan 21, 2025

There are now python based tests for the document portal (#1594). Would be great if a test for the case which this PR is trying to fix was added.

{
gchar *result;
g_autofree char *host_path = xdp_get_real_path_for_doc_id (doc_id);
g_autofree char *doc_path_regex = g_strconcat("/run/user/[0-9]+/doc/", doc_id, "/[^/]+(.*)", NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be avoided if xdp_looks_like_document_portal_path would add another out param which returns the path relative to the document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

3 participants