-
-
Notifications
You must be signed in to change notification settings - Fork 807
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
current_working_dir.file_path returns partial result for paths with '#' in the name #6158
Comments
Hi Syntaxheld, The URL parser treats anything after '#' as a fragment. And the same thing happens with everything after '?' being treated as a query. This could be fixed. But, since the current working directory should always return a nil file_path, what are you trying to do by using .file_path in the first place? What is the situation where this bug is a problem for you? |
@loops I stumbled over this as part of a workaround for #6154 ... I wanted the window title to show the working directory of the current tab (/ active pane). This bug is not a problem for me, since by now I am using user variables to do what I need.
Why? Docs say cwd is a URL object, and URL docs say " |
Sounds like we should avoid using the Url::parse constructor for paths and find a different way to create a url for a path, because there is no reason that this shouldn't work |
perhaps https://docs.rs/url/latest/url/struct.Url.html#method.from_file_path |
When referencing the current-working-directory, before it is set by an OSC 7 escape sequence, we ask the OS for the correct path. This path was then being parsed as a URL; where a "#" or "?" character would be interpreted as the start of a fragment or query component of a URL -- which is a mistake. So this change parses the returned directory as such, where those characters will be treated as a normal character in the path. Nothing is changed for the OSC 7 escape sequence case. In that case, the application must percent-encode the path before sending, so that those characters are not misinterpreted. As per issue wez#6158 reported by Syntaxheld
When referencing the current-working-directory, before it is set by an OSC 7 escape sequence, we ask the OS for the correct path. This path was then being parsed as a URL; where a "#" or "?" character would be interpreted as the start of a fragment or query component of a URL -- which is a mistake. So this change parses the returned directory as such, where those characters will be treated as a normal character in the path. Nothing is changed for the OSC 7 escape sequence case. In that case, the application must percent-encode the path before sending, so that those characters are not misinterpreted. As per issue wez#6158 reported by Syntaxheld
When referencing the current-working-directory, before it is set by an OSC 7 escape sequence, we ask the OS for the correct path. This path was then being parsed as a URL; where a "#" or "?" character would be interpreted as the start of a fragment or query component of a URL -- which is a mistake. So this change parses the returned directory as such, where those characters will be treated as a normal character in the path. Nothing is changed for the OSC 7 escape sequence case. In that case, the application must percent-encode the path before sending, so that those characters are not misinterpreted. As per issue #6158 reported by Syntaxheld
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
What Operating System(s) are you seeing this problem on?
macOS
Which Wayland compositor or X11 Window manager(s) are you using?
No response
WezTerm version
wezterm 20240915-153243-2d0c5cdd
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
Yes, and I updated the version box above to show the version of the nightly that I tried
Describe the bug
When the current working directory name contains a hash ('#'), the result of
tab.active_pane.current_working_dir.file_path
ends before that hash.To Reproduce
mkdir 'folder with #tag'
cd 'folder with #tag'
The
current_working_dir
result will include the whole name, but thecurrent_working_dir.file_path
representation will end before the#
.Configuration
Expected Behavior
file_path
should include the hash and the rest of the path name.Logs
Anything else?
No response
The text was updated successfully, but these errors were encountered: