How can I avoid iTerm trying to scp a file when ⌘-clicking it? I am working with a developer setup so that I run my code in a docker container and be able to edit it locally (via volume). Local path is e.g. /path/to/my/project while inside docker container it is /app/source.
Say I have a file relative to the project called app/models/team.rb.
On an error in the container I see an output like this:
/app/source/app/models/team.rb:13:in my_method...

iTerm seemed to be smart about the open on ⌘-click such that it underlined only the app/models/team.rb:13 (incl. line number) when I hover over the a of app (unfortunately only on the first character), and opened the local file in my editor (VSCode). That was already great.
I now added an iTerm profile that identifies when a session is running inside docker (greedy: auto profile switching checking for &quot;&amp;docker&quot;) and sets the hostname and path via Triggers and regex (besides colors etc). This also works fine.
However now when I hover over the filename, the whole path is underlined and when I ⌘-click, iTerm tries to download via scp (which fails).
How can I avoid iTerm to try to scp the file and make it realize again how to load the local file?
I already tried not to set the hostname, but this results in iTerm not providing anything anymore for opening. When I don't set the path then it's working like before of course, but I'd like to have this information of the docker container in the status bar.
I know this is not a direct answer to your question, but here is how I have handled the situation in other cases. Instead of mounting your local volume at /app, mount it in the container at /path/to/my/project. That way the file has the same path name inside Docker as outside it and you can skip special processing of the path name in iTerm.
If you are running Docker Desktop for Mac, the default osxfs driver will handle for you the issues arising from the files having different owners and permissions inside the container than outside and you do not have to worry about it. (This is a unique benefit of running on the Mac, other platforms do not have this feature at this time.)