dont mkdir any path that starts with '..' (instead of '../' previously)#3225
Merged
lervag merged 1 commit intolervag:masterfrom Nov 9, 2025
Merged
dont mkdir any path that starts with '..' (instead of '../' previously)#3225lervag merged 1 commit intolervag:masterfrom
lervag merged 1 commit intolervag:masterfrom
Conversation
Owner
|
Thanks, I appreciate the proposed fix. I'll probably accept it, but please consider my questions/comments in #3224 first. |
Owner
|
Cool, as I can now reproduce this, I also understand it better. So, I don't think we should change the regex here. Instead, we should apply a diff --git a/autoload/vimtex/compiler/_template.vim b/autoload/vimtex/compiler/_template.vim
index 7ec64c3b..28b5022c 100644
--- a/autoload/vimtex/compiler/_template.vim
+++ b/autoload/vimtex/compiler/_template.vim
@@ -125,7 +125,7 @@ function! s:compiler._create_build_dir(path) abort dict " {{{1
call filter(map(
\ l:dirs, "fnamemodify(v:val, ':h')"),
\ {_, x -> x !=# '.'})
- call filter(l:dirs, {_, x -> stridx(x, '..') != 0})
+ call filter(l:dirs, {_, x -> stridx(x, '../') != 0})
else
let l:dirs = glob(self.file_info.root . '/**/*.tex', v:false, v:true)
call map(l:dirs, "fnamemodify(v:val, ':h')")
@@ -136,6 +136,7 @@ function! s:compiler._create_build_dir(path) abort dict " {{{1
call map(l:dirs, {_, x ->
\ (vimtex#paths#is_abs(a:path) ? '' : self.file_info.root . '/')
\ . a:path . '/' . x})
+ call map(l:dirs, {_, x -> simplify(x) })
call filter(l:dirs, '!isdirectory(v:val)')
if empty(l:dirs) | return | endif |
Fixes bug where 'mkdir('./build/..') is called
Contributor
Author
|
Your solution is more robust, thanks for letting me commit it. |
Owner
|
No problem, and thanks again for your contribution! I'm always happy when people (like you) both detect a problem and attempt to fix it themselves, and I'm glad to assist and let you complete the final stages. :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Addresses #3224 . Tests (ran with
makeintestsfolder) run.