-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Various fixes #355
Various fixes #355
Conversation
senko
commented
Dec 10, 2023
- fix Windows file path escaping in file modifications
- be explicit about the log code page (also helps for Windows)
- improve file overwrite message
escaped_file_path = re.escape(file_path) | ||
|
||
pattern = rf'\*\*{escaped_file_path}\*\*:\n```\n(.*?)\n```' | ||
pattern = rf'\*\*{re.escape(file_path)}\*\*:\n```\n(.*?)\n```' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just removes escape_file_path
variable to avoid confusion with similarly-named but differently escaped file path a few lines below. No changes to the pattern.
|
||
new_section_content = f'**{file_path}**\n```\n{new_content_escaped}\n```' | ||
new_section_content = f'**{file_path_escaped}**\n```\n{new_content_escaped}\n```' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Windows paths have plenty of occurrences of \
which were not escaped in a recent change to this.
pilot/helpers/Project.py
Outdated
@@ -121,7 +121,7 @@ def start(self): | |||
print('yes/no', type='button') | |||
should_overwrite_files = styled_text( | |||
self, | |||
f'Do you want to overwrite the dev step {self.args["skip_until_dev_step"]} code with system changes? Type y/n', | |||
f"Can I overwrite any changes that you might have made to the project since last running GPT Pilot (y/n)?", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to other changes, this is just a rewording of the message because the previous one is really unclear even to people who work on GPT Pilot (ie. me 😄 ).
file_handler = logging.FileHandler( | ||
filename=os.path.join(os.path.dirname(__file__), 'debug.log'), | ||
mode='w', | ||
encoding='utf-8', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding encoding so logging doesn't crash on Windows when there are characters which don't fit into whatever code page is active by default.
* fix Windows file path escaping in file modifications * be explicit about the log code page (also helps for Windows) * improve file overwrite message