Allow @ symbol in filename root_path for Kqlmagic initialization #101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Description
This PR fixes the bug reported in Issue #100
Future Release Comment
Before this fix, Kqlmagic initialization failed in restricted environments where new folder creation at user root (/home/user@domain) level is not allowed. The reason for this fail was, while trying to create Kqlmagic initialization folder, the root_path variable omitted @ symbol from path, which resulted in a non-existent path that needed to be created. Since the @ symbol often only existed in the user's home directory, it was not possible to create a new folder at user root level, leading to PermissionError and failure to initialize Kqlmagic.
Example:
If the following Kqlmagic initialization folder needs to be created:
kqlmagic/temp_files/<kernel-id>
at the root_path/home/user@domain
then the expected outcome should be a new folder/home/user@domain/kqlmagic/temp_files/<kernel-id>
. However, the functionjupyter-Kqlmagic/azure/Kqlmagic/kql_magic_core.py
Line 294 in b1c4d26
would return the following file path
/home/userdomain/kqlmagic/temp_files/<kernel-id>
to be created.Tracing this
adjust_path
function call -->jupyter-Kqlmagic/azure/Kqlmagic/my_utils.py
Lines 131 to 134 in b1c4d26
jupyter-Kqlmagic/azure/Kqlmagic/my_utils.py
Lines 126 to 128 in b1c4d26
jupyter-Kqlmagic/azure/Kqlmagic/my_utils.py
Lines 96 to 123 in b1c4d26
jupyter-Kqlmagic/azure/Kqlmagic/my_utils.py
Lines 36 to 44 in b1c4d26
we arrive at the Regex substitution line, where it removes the @ symbol as well. The original intent derived from comments is to
The patch modifies the Regex substitution to include the @ symbol and thereby solving the reported bug.
Breaking Changes:
Features:
Fixes:
azure/Kqlmagic/my_utils.py