Skip to content

gfile: Do not return target-uri from g_file_peek_path()

Ondrej Holy requested to merge wip/oholy/peek-path-fixes into master

Documentation says that g_file_peek_path() returns exactly the same what g_file_get_path(), but this is not true. Apart from that the code segfaults for some uris (e.g. for "trash:///"), it returns target-uri for trash and recent schemes. This is unexpected and can lead to various issues among others because the target-uri paths are not automatically translated back to GDaemonFile as it is done with gvfsd-fuse paths. g_file_get_path() returns NULL for trash and recent schemes, because fuse paths are not provided for those schemes. So g_file_peek_path() should return NULL as well. It is up to the concrete application to use target-uri when appropriate.

This change was made as a part of commit 4808a957, however, neither the commit message, neither the corresponding bug doesn't mention this crucial change and doesn't give any clear reasoning. So let's revert this.

Merge request reports