[Github-comments] [geany/geany] Use relative paths for project session files if base directory is relative (PR #3021)

Jiří Techet notifications at xxxxx
Sat Nov 27 17:10:35 UTC 2021


> As I've stated, I think this PR is reasonable and would support merging it with a few minor changes.
> 
> * Add some comments to make clear to people staring at the code in the future what the intended behavior is.
>   
>   * To note that `g_file_get_relative_path` does not create `..` paths.
>   * To make clear that the purpose of lines 1290-1298 is to unpack relative paths for project files.  (similar to the comment at 368-369)
>   
>   
>   * To note that non-project relative paths are not handled at this time (so people working on config/session split will know what to do when refactoring this code).
> * Add a check to drop paths with `..` to prevent access to files outside the project folder.
>   
>   * Even though this PR doesn't write relative paths in certain ways, session and project files can be edited externally or another PR may change it.

With this I'll probably wait for a review of someone who might want to merge it - in the past we didn't add comments to things that were pretty obvious from the code and while it may be your personal preference, it may not be the preference of the maintainer. I also don't see a reason to check for `..` - the current code doesn't store paths outside the base directory as relative so these won't be stored. And if we ever decide to store them this way, why prevent opening them?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3021#issuecomment-980718553
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20211127/7bb99217/attachment.htm>


More information about the Github-comments mailing list